Boats float because of something called buoyancy. Buoyancy is what makes things like boats, apples, and even people able to float in water. It has to do with density.
Density is how much stuff, or matter, there is in a certain space. Things like rocks, steel, and iron have more matter in the same amount of space than things like air, water, and wood. This means they are more dense.
Since boats and other things like them are made mostly of wood and other materials that aren't that dense, they are less dense than the water they are sitting in. When something is less dense than the water, it will float!
This is because the water pushes up around the boat, and it is like an invisible cushion that is keeping the boat afloat. This force is called buoyancy and it is what makes boats float.