The end-Cretaceous mass extinction knocked off not only the dinosaurs (except for birds), but also air-breathing marine predators like mososaurs and plesiosaurs. Birds and mammals started moving into the empty niche: penguins from early on, and eventually whales.
(Cartoon by Sam Gross. Not scientifically accurate.)
The whale story is particularly dramatic. When Darwin was tried to account for the evolution of whales from a land-dwelling ancestor, he cited accounts of bears swimming and feeding in water, and wrote “I can see no difficulty in a race of bears being rendered, by natural selection, more and more aquatic in their structure and habits, with larger and larger mouths, till a creature was produced as monstrous as a whale.” This statement attracted so much ridicule that Darwin took it out of later editions of the Orgin of Species. But he turns out to have been very much on target. We now have a great sequence of whale ancestors. The sequence runs from yesterday’s Pakicetus — a wolf size meat-and-fish eater that splashed along the shores of the ancient Tethys sea separating Africa from Eurasia — to today’s “walking whale,” Ambulocetus, and on to true whales. Darwin was sort of on the right track thinking of bears, but anatomy and genetics put the ancestors of whales firmly among artiodactyls – hooved animals including hippos, pigs, and cows.