How does buoyancy work?
An object immersed in a fluid experiences buoyancy because fluid pressure acts over its surface. In a fluid at hydrostatic equilibrium, pressure increases with depth. Greater pressure on lower surfaces produces a net upward component.
Archimedes' principle
The buoyant force equals the weight of displaced fluid. Moving a fully submerged object deeper does not increase buoyancy in the incompressible-fluid approximation if its volume stays unchanged. A floating object displaces just enough fluid for buoyancy to balance its weight. The principle also applies to gases, as illustrated by hot-air balloons.
Why can ships float?
Air inside a steel ship can make the structure's average density lower than water's density. Total mass and the volume excluding water matter, rather than the density of steel alone. Flooding changes this balance. Stability additionally depends on the relative positions of the centers of gravity and buoyancy: sufficient upward force does not guarantee resistance to capsizing. Salinity and temperature also affect fluid density.