What determines whether an object will float or sink is its density,
which is how heavy it is for its size. Something that is less dense
than water will float on water, and something that is denser than
water will sink. For example, a cork is light for its size, so it
floats, while a rock is heavy for its size, so it sinks.
Note that size counts, not just weight. You could have a little rock
and a great big piece of cork that weighed the same amount, and the
cork would still float and the rock would still sink.
Metal is denser than water, and so a solid piece of metal will sink.
But a ship is not solid metal--it contains a lot of air in its volume,
so it is less dense than solid metal. That's how metal ships can
float: they contain enough air to make their total density less than
the density of water.
Here are some links to other pages that explain this same idea.
Article on density by Martha Marie Day, Ed.D. on the Visionlearning site
Explanation by Donald Howard on Madsci Network
An explanation "borrowed from Bill Nye the Science Guy" (halfway down the page)
I hope this explanation is helpful.