In order to understand what allows submarines to stay underwater, it is important to first look into why things float on water in the first place. Archimedes showed that an object will float if the weight of that object is less than the weight of the water it displaces. As you may be aware, when you get in a bath you are displacing the water – this causes the water level to rise. The effect is known as buoyancy and accounts for why big steel ships don’t sink.
Submarines fall into two different categories: static divers and dynamic divers. Static diving uses differences in weight to affect the buoyancy, whereas dynamic diving uses speed and power to submerge, a little bit like how aeroplanes fly. Static diving submarines can submerge by taking on more water through the use of ballast tanks. To return to the surface they can dump this extra weight to regain their buoyancy. The mechanism by which these ballast tanks work may involve an electric motor or compressed gas. Dynamic divers use fins or hydroplanes along with speed to force themselves underwater. This means if they slow down they return to the surface.
The important thing to remember is that a submarine isn’t just air inside; yes it has some, but it’s the overall weight with respect to the amount of displaced water which causes something to float or sink.
Rik Sargent, Science Museum