Ships are typically made of metal. Metal is denser than water, and therefore air-filled buoyancy chambers are built into them. This makes the ship less dense compared to the volume of water it occupies, thus enabling it to float.
That could be the answer, or the ship isn't completely made of metal.
------------------------------------------------------
Hope this helps!
Have a great day and God bless! :)