Definition: To be enjoying something immensely
Example: The children had a whale of a time at Sarah’s sixth birthday party, fuelled by chocolate and all the cola they could drink. The parents had a less fantastic time.
Whales are big. Especially blue whales, the largest mammals on the planet. So anything described in terms of a whale will be big, immensely big. The word is used as an ‘intensifier‘. There are a number of phrases describing things in terms of giant sea mammals: whale of a lot, whale of a job, whale of a difference, etc, etc, though they are not as commonly used as whale of a time.
As to its introduction to the English language, that seems to be somewhere around 1900, along with the other related phrases.
The phrase has absolutely nothing to do with Jonah, the biblical character swallowed by a whale. His experience was not in the least bit enjoyable so would not be a birthplace for the phrase.
Iddy certainly seems to be having a whale of a time. He seems to have totally forgotten that salt water plays havoc with his skin.