Submarines are able to control their depth via ballast tanks that take on or release water to make the submarine more or less buoyant than the water around it, explains How Stuff Works. This causes the submarine to float or sink.Know More
While at the surface, a submarine floats the same way a ship does. The water they displace is equal to the weight of the ship, which creates a buoyant force that counteracts gravity. However, submarines are different from other ships, because other ships have a set buoyancy and submarines can change how buoyant they are.
Submarines have ballast tanks that can be filled with either water or air. While on the surface, the submarine's tanks are filled with air, just as a ship is. When the crew of a submarine wants to sink, they discharge the air in their tanks and fill the tanks with water. Filling the tanks with water creates a negative buoyancy, and this negative buoyancy causes the ship to sink. The submarine crew can control the angle at which they dive by adjusting the angle of the short wings on the top of the submarine, also called hydroplanes. In case of emergency, submarines carry a supply of compressed air that allows them to return to the surface, should the need arise.