A boat rights itself and a submarine may not
Why surface stability and submerged stability are different problems.
A boat rights itself because tipping it changes its underwater shape, pushing one side deeper and lifting the other clear, and that changing shape drags its centre of buoyancy sideways to create a restoring turn even when its centre of gravity sits above the centre of buoyancy. A fully submerged submarine has no equivalent trick, since it is already surrounded by water on every side and tipping it leaves the shape of the water it displaces unchanged, so its stability rests on the plain vertical arrangement of the two points alone.
How a heeling hull moves its own buoyancy
A boat sitting level displaces a wedge-shaped volume of water below its waterline, and the centre of that wedge, its centre of buoyancy, sits directly below the centre of gravity. Heel the boat and the wedge changes shape: the low side sinks deeper while the high side lifts clear, and the centre of the new, lopsided wedge shifts toward the low side. That shifted buoyant force no longer lines up under the weight, and the offset produces a torque that pushes the hull back toward upright. The whole correction depends on part of the hull sitting above the waterline with room to lift clear.
Beam matters enormously here. The shape-driven part of the restoring turn grows with the cube of the hull's width at the waterline, so for the same length and the same small roll, a hull twice as wide gets about eight times as much of it. That is why a wide-beamed boat feels stiff underfoot while a narrow one feels tippy under an identical load, and why widening the beam usually does more for surface stability than adding ballast low down.
Pressing on one edge of a floating pool mattress and feeling it push back harder the further it sinks is this effect in miniature. Hold the whole mattress under with both hands and the growing push disappears, replaced by a plain, uniform urge to rise, because nothing is left above the waterline to reshape.
A weighted bottle under the bath water
Weight a plastic bottle at the bottom with a little sand and push it fully under water, then roll it by hand. Whichever way it is turned, it displaces exactly the same volume in exactly the same shape, because there is no waterline left to rise or fall on either side. Any tendency to roll back to one orientation comes purely from the sand pulling the centre of gravity below the centre of buoyancy, like a slow pendulum. Empty out the sand and the submerged bottle settles happily in any orientation, since changing its displaced shape is the one trick a fully surrounded body has lost.
Checking a submarine twice
A submarine therefore has to secure its stability by design, placing its centre of gravity safely below its centre of buoyancy with a comfortable margin, usually with heavy fixed ballast as low in the hull as the layout allows. That ballast is bolted in as a permanent part of the structure, because removing it would remove the only mechanism the hull has for staying upright underwater. A boat, by contrast, can carry heavy cargo well above the waterline and stay perfectly stable.
When a submarine surfaces it briefly becomes a boat again, regaining the waterline effect for as long as part of its hull sits above the water. Its stability is checked once for the surfaced condition and once for the submerged one, since passing one test says nothing about the other. A hull that floats stably only because a large air-filled compartment rides above the waterline can become marginal or worse the moment that compartment floods and goes under.