Let's see how they work. The name of the game in diving and surfacing is bouyancy. When an object is put in the water, if it displaces less water than the objects volume, the object floats or has positive bouyancy. If the object weighs more than the water displaced by its volume, it sinks or has negative bouyancy. This is why a piece of cork will float and a piece of metal will sink.
Submarines contain ballast tanks.
The Blueback has six of them. For a submarine to dive, it first opens vents at the top of the ballast tanks. At the bottom of the ballast tanks are flood ports to the sea that are always open. When the vents are opened, air rushes out the top and water flows into the bottom of the ballast tanks. This makes the submarine heavier and heavier until it has negative bouyancy.