a whale is a very large animal. Most of them live in the sea, and a small part of them live in fresh water. They are similar in size to fish, and their bodies are streamlined, which makes them better swimmers, hence the "fish" in their name. But in fact, they are not fish, but a mammal. They are similar to fish in structure, just because they live in the same environment, which leads to their convergence in the process of evolution, making them similar to fish.
However, whales themselves are not fish, and even if they live in the ocean, they can not change their mammalian attributes. Whales have a lot in common with mammals that live on land. For example, breathing with lungs, viviparous reproduction and so on, these are their common characteristics as mammals, but also the characteristics that we distinguish between fish and mammals.
As mentioned above, whales are a kind of mammals, not fish. Their way of breathing is very different from that of fish, which breathe with gills, while whales breathe with lungs. This characteristic makes them unable to breathe in water. When they breathe, they have to come out of the water. If we can observe their breathing at close range, we will find that there will be a small water column on the surface of the water at this time, which is the formation of their breathing. Because their lung capacity is very large, they can swim for a long time after a breath, and they can come out of the water to breathe for a period of time.