Whales, dolphins, porpoises, seals, walruses, and many other marine animals are mammals, not fish. The marine mammals exist because about 50 to 60 millions of years ago, some mammals wandered off of the land and into the ocean, and there they evolved into different types of marine mammals. For whales and dolphins, their front legs turned into flippers. Their back legs became really tiny, so tiny that you can't even see them when you look at these animals, but they have hind legs still inside their bodies -- if you see a skeleton of a whale you can see it has tiny leg bones near its tail. Here's an interesting discussion of the hind legs in whales and dolphins:
whalesLike mammals, whales and dolphins breathe air through a pair of lungs, they are warm-blooded, their young drink milk, and they have hair (although very little). The whale is actually the closest living relative of the hippopotamus. Here's some good information on the difference between whales and dolphins and fish:
cetacea-mammalian-nature