Hi, Hailissa. An object in a fluid experiences an upward force equal to the weight of the fluid displaced by the object. So if a boat weighs 1,000 pounds (or kilograms), it will sink into the water until it has displaced 1,000 pounds (or kilograms) of water. Provided that the boat displaces 1,000 pounds of water before the whole thing is submerged, the boat floats.
It is not very hard to shape a boat in such a way that the weight of the boat has been displaced before the boat is completely underwater. The reason it is so easy is that a good portion of the interior of any boat is air (unlike a cube of steel, which is solid steel throughout). The average density of a boat -- the combination of the steel and the air -- is very light compared to the average density of water. So very little of the boat actually has to submerge into the water before it has displaced the weight of the boat. (SEE COMMENTS)
This is too hard to explain without a lot of technical physics jargon but basically it has to do with the shape of the boat bottom and the physical properties of water and how it interacts with the bottom of the ship or boat. Things like surface tension and water pressure and displacement and stuff like that.