Unfortunately the answer is no, whales are unable to breathe underwater.
Despite living exclusively in the ocean like fish and other aquatic animals whales are mammals which means they are warm-blooded, produce milk, give live birth to their children (rather than laying eggs) and breathe air.
In order to inhale and exhale air whales breathe through their blowhole(s) which are located on the top of the whales head.
Note: Depending on the whales suborder they are born with either one or two blowholes.
When a whale dives underwater the sphincter muscles surrounding its blowhole contracts allowing the whale to swim underwater without having to worry about accidentally inhaling water.
When you see water spout from a whales blowhole that means that the whale is exhaling.
The water that spouts into the air comes from the water surrounding the blowhole, not water that was ingested by the whale during its dive.
If a whale were to inhale water into its blowhole the water would enter the whales lungs and the whale would drown.
In fact there are a number of cases where a whale can end up getting stuck in shallow water and ends up drowning because the water they are in covers their blowhole and the land that they come into contact with in the shallow water prevents them from moving and being able to rise to the surface.
The reason whales breathe through their blowhole and not their mouth is because the trachea (air passage) and esophagus (food passage) is not connected.
This means that the whale has completely separate holes for breathing and eating, which is extremely important for their survival.
By having separate holes whales are able to easily take in oxygen since their blowhole is located on the top of their head rather than near their mouth; it also means they do not have to lift their mouth above the water in order to breathe which would require additional energy and cause unnecessary effort during rest periods.
In addition to helping them breathe having separate holes also makes it easier for whales to consume food without having to worry about their lungs being filled with water.
For instance if a human were to consume food underwater they might end up drowning because they risk bringing water into their lungs every time they open their mouth/nostrils as their body may try to take in oxygen along with the food they consume.
Whales on the other hand are able to easily keep their blowhole closed (effectively closing off their air passage) while consuming food underwater.
Since whales are constantly surrounded by water these marine mammals are always conscious of their breathing and have developed a lot of control over their oxygen supply, breathing and vital organs.
In fact whales are able to take in much more usable oxygen than land animals and humans.
One estimate states that a whale may be able to store and use up to 90% of the oxygen they inhale.
Whales are also able to shut down non essential functions in order to maximize the efficiency of their oxygen usage.
Depending on the whales species whales have been known to hold their breath anywhere from 5 minutes up all the way up to 90 minutes during deep dives.
Due to their consistent conscious effort to control their breathing whales are referred to as conscious breathers.
This is extremely important because if a whale were to pass out or fall asleep while in the ocean there is a good chance it would sink and/or drown.
Because of this fact the whales brain is always semi active so the whale never falls completely asleep.
While they rest half of their brain goes into a restful state while the other half remains active allowing them to respond to danger immediately and swim back to the surface for more air when necessary.
Sometimes these marine mammals can be seen logging across the surface of the ocean laying motionless so that they can easily inhale air without the fear of drowning.
As stated earlier having their blowhole on the top of their head means they can continuously rest rather than being forced to lift their mouth up to take in oxygen.
Although researchers state that whales are also capable of sleeping while submerged they are likely to stay close to the surface so that they can come up for air when necessary.
During rest periods whales have been observed resting for extended periods of time in order to maintain their energy and have also been seen take several short naps over the course of a day in order to give their brain and their body the rest it needs so that they can perform their daily tasks effectively and efficiently.
Due to their large size most of what we know about a whales breathing and sleeping habits comes from the dolphin species since whales are typically too large to observe in close detail using brain motioning technology.
Electroencephalographs have been hooked up to dolphins while they rest in order to gain a better understanding of what happens to these marine mammals when they sleep.
In many ways dolphins share a lot of the same physiological traits with whales, so it’s possible develop a decent understanding of the whale species through observations of dolphins such as their intellectual capabilities, respiratory system, resting state, anatomical features and lineage or evolutionary beginnings.
All three species share the same respiratory characteristics and must come to the surface in order to breathe; none of them are born with gills or specialized lungs that would allow them to extract oxygen from the water.
Although cetaceans do not have gills or lungs capable of breathing under water they are all capable of inhaling much more usable oxygen than humans which they can use to bring into their blood stream and vital organs allowing them to hold their breath for longer periods of time.
If you look at the evolution of cetaceans the earliest ancestors to these marine mammals were land dwelling animals that hunted on land and breathed air.
This evolutionary look into their heritage helps explain why whales breathe air instead of possessing gills.
Over the course of millions of years these marine mammals have adapted from living on land to pursuing a life in the ocean.
Although they’ve gone through a number of evolutionary changes in order to thrive and survive in the ocean they still require air to breathe.
Whether this is because evolution has decided that its more efficient to breath air than develop gills is unsure, but we do know that evolution focuses on survival and this is likely the best decision for the survival of the cetacean species given the amount of time they had to evolve into ocean dwelling animals.