how does ships float even when metal sinks in water?
The situation can be understood by taking an iron nail sinks while the ships made of iron floats that all depends on density and shape. Ships are designed to displace more water so that the can get more buoyancy force to retain on water surface while and iron nail is not such designed. Further
Whether a body will float or sink depends on the density of the body. Density of a body is the mass divided by the volume of the body.