Corks float on water because it contains a lot of air making it less dense than water. Solids and liquids with less density float on denser liquids.
Cork is a bark tissue that is riddled with many tiny holes. These holes hold air. The air decreases the density of the cork. This makes the cork buoyant so that it floats on water. As the cork sinks into the water, it displaces water. The water it displaces weighs more than the cork itself. The denser water acts with force on the less dense cork holding it up in the floating position. Any substance that is less dense than water floats by the same mechanism.