The association of whales with the Jonah myth comes from the Sepuagint, the Greek translation of the Hebrew Bible. The original of Jonah 2:1 reads:
the fish is rendered into Greek as mega kētos (μέγα κῆτος). To the Greeks, this meant any huge sea creature or sea monster. The word is also the root of the Latin cetus, and this is where the association with whale comes from. Cetus is also the root of the scientific nomenclature for whale species, Cetacea.
There are two myths regarding kētos: Perseus & Andromeda and Heracles & a variation on this story in the ninth work of Heracles, where he defeats a sea monster (not specifically a whale) to save Hesione. In Appolodorus 2.5.9, we read:
διὰ τοῦτο Ἀπόλλων μὲν λοιμὸν ἔπεμψε, Ποσειδῶν δὲ κῆτος ἀναφερόμενον
ὑπὸ πλημμυρίδος, ὃ τοὺς ἐν τῷ πεδίῳ συνήρπαζεν ἀνθρώπους. χρησμῶν δὲ
λεγόντων ἀπαλλαγὴν ἔσεσθαι τῶν συμφορῶν, ἐὰν προθῇ Λαομέδων Ἡσιόνην
τὴν θυγατέρα αὐτοῦ τῷ κήτει βοράν, οὗτος προύθηκε ταῖς πλησίον τῆς
θαλάσσης πέτραις προσαρτήσας. ταύτην ἰδὼν ἐκκειμένην Ἡρακλῆς ὑπέσχετο
σώσειν, εἰ τὰς ἵππους παρὰ Λαομέδοντος λήψεται ἃς Ζεὺς ποινὴν τῆς
Γανυμήδους ἁρπαγῆς ἔδωκε. δώσειν δὲ Λαομέδοντος εἰπόντος, κτείνας τὸ
κῆτος Ἡσιόνην ἔσωσε. μὴ βουλομένου δὲ τὸν μισθὸν ἀποδοῦναι, πολεμήσειν
Τροίᾳ ἀπειλήσας ἀνήχθη.
3 Therefore Apollo sent a pestilence, and Poseidon a sea monster,
which, carried up by a flood, snatched away the people of the plain.
But as oracles foretold deliverance from these calamities if Laomedon
would expose his daughter Hesione to be devoured by the sea monster,
he exposed her by fastening her to the rocks near the sea.4 Seeing her
exposed, Hercules promised to save her on condition of receiving from
Laomedon the mares which Zeus had given in compensation for the rape
of Ganymede.5 On Laomedon's saying that he would give them, Hercules
killed the monster and saved Hesione. But when Laomedon would not give
the stipulated reward,6 Hercules put to sea after threatening to make
war on Troy.
Following the association of ketos specifically to whales via the Latin denomination, this is probably what you're looking for, though Heracles was not swallowed by the creature according to the tale. In the original Greek of Apollodorus this refers to an undetermined sea monster, just like the Hebrew of Jonah refers to an undetermined big fish.