When a submarine is at the ocean surface, tanks are full of air to keep it floating. To let it sink, water is filled into the tanks instead to increase the submarines weight. There is now not enough upthrust to balance it so it sinks. To rise back up, the tanks carry compressed air to fill the tanks.