As seen above, whales diverged from the mammal line before humans and horses did. They branched off of the branch of Artiodactyls. Hippos branched off from whales, and became Anthracotheres. Whales became Archaeocetes, and then later, Cetaceans.
The evolutionary tree above shows how whales evolved slowly over time, and how much whales grew in size. The skeletons are obviously what the animal's bone structure looked like, but off to the side, the grey figures are how large the animal was in comparison to the other whale ancestors.