The idiom is thought to have originated in the 17th century when whales were commonly hunted and people were fascinated by their immense size and strength. The term "whale" is believed to have been chosen to emphasize the magnitude and significance of the story being described, much like how a whale stands out as a massive creature in the ocean.
When someone says "whale of a story," they are essentially suggesting that the story is so extraordinary, compelling, or entertaining that it is comparable to the awe and impact of a whale sighting. It implies that the story is captivating, memorable, and worth listening to or experiencing.