A block of solid steel plunges straight to the bottom; a steel ship of equal weight rests on the surface. The contrast is not magic but geometry and fluid mechanics at work.
The key lies in density and Archimedes principle. A solid steel cube packs mass into a small volume, so its average density is greater than that of water. When dropped in, it displaces only a small amount of water, so the upward buoyant force cannot match its weight. Gravity wins and the cube sinks.
A ship spreads the same mass over a far larger volume, most of it hollow and filled with air. That hull shape forces aside a much greater mass of water. The resulting buoyant force, defined by fluid statics as the weight of the displaced water, can be tuned by designers to equal or exceed the ship’s weight. As long as the overall density of the hull plus its cargo stays below that of water, the vessel floats, even though every plate in its structure is made of sinking steel.