Did hippos evolve from whales or did whales evolve from hippos?

Neither. They had a common ancestor.

http://www.oceanlink.info/wot/ancestry.html

Hippos did not evolve from whales, nor did whales evolve from hippos. Both hippos and whales belong to the mammalian group called Cetartiodactyla, which also includes animals like cows and deer. Whales are believed to have evolved from a group of land-dwelling mammals called artiodactyls, which include animals like pigs and camels. The exact evolutionary pathway of whales is still a topic of scientific research and debate. Hippos, on the other hand, have a different evolutionary history and are not closely related to whales.

Hippos and whales are actually two separate lineages of mammals that evolved from a common ancestor called a common artiodactyl ancestor. This ancestor lived around 50-60 million years ago. It was a terrestrial mammal, similar to a small deer or pig, and was not directly related to either hippos or whales.

Over time, some members of this common ancestor's descendants adapted to aquatic environments and evolved into the ancestors of modern whales. These early whales gradually developed adaptations like streamlined bodies, flippers, and a blowhole, which allowed them to become efficient swimmers in the water.

On the other hand, the common ancestor's other descendants remained on land and eventually diverged into different lineages, one of which led to the evolution of hippos. Hippos are classified as part of the artiodactyl group Cetartiodactyla, which also includes whales, dolphins, and porpoises. Therefore, hippos and whales are distantly related, but they evolved along different paths from their common ancestor.