To dive underwater and then resurface, the submarine's crew must be able to control the ship's weight or density. We can compare this to an empty can floating in the water. By controlling the amount of water we pour into the can, we can control the rate and depth of its dive under the water's surface.
Submarines have an inner and an outer steel shell, called a hull.
The area in between the two hulls is called the ballast tank. It can be filled with either air or water. When the submarine is on the surface, the ballast tanks are filled with air and the submarine's overall density is less than that of the surrounding water. Ballast tanks are open at the bottom. To dive, the submarine operator opens up valves at the top and lets air out.