Both mammals and aquatic animals need oxygen but have developed different mechanisms. Marine mammals, such as whales, do have lungs. They take in oxygen through their blow holes, or for manatees and dugongs, through their snouts.
A fish breathes by taking water into its mouth and forcing it out through the gill passages expelling the ‘stale’ water behind. Fish continuously ventilate their gills pumping water over their gills by moving their mouth. Gills are feathery organs full of blood vessels.
These allow fish to extract oxygen from the water. When the water passes over the thin walls of the gills, dissolved oxygen moves into the blood and travels to the fish's cells. Dolphins are not like whales or fish. They do not possess gills so they must come to the surface of the water to breathe.