whales need to breathe air from time to time like a land mammal, so some land mammals that would primarily spend time near water, may have evolved into whales and the other specie of land mammals that died off because they could not go in the water, only left the sea mammals species behind.