How did mammals come to rule the ocean, when they seem so maladaptive to it?

Basically the title. Mammals seem well adapted to the land and it seems strange that they would evolve back into the water and come to be nearly all of its apex predators.

ETA: "Rule" in the context of being all of its apex predators. Wherever fish and mammals meet, a mammal is the apex predator. Are there exceptions to this?