Density = Mass/Volume
As you see, volume is inversely proportional to density.. The mass of the ship is far outreached by the volume of the ship, so the density becomes less than the density of the water the ship floats in. Plus ships hold a lot of air which is less dense than water.