Why do whales have holes on their heads?

As you know, whales do not have gills like fish. In fact, because they are mammals, they take in air through nostrils. The nostrils of whales, called “blowholes”, are located on top of their heads. Every once in a while, whales come to the surface of the water and open their blowholes to breathe.