The main reason oil floats in water is because it is less dense than water. Anything less dense than water will float, including the human body, which contains fat, a chemically similar substance to oil.
However, oil also is immiscible in water, meaning the two do not mix. In other words, water likes being water more than it wants to mix with oil. The bonds that hold both of these substances together are stronger than the forces that would normally dissolve a substance in water. When water dissolves another substance, it breaks apart the molecules to form new ones. In the case of oil and water, the bonds are strong enough in each substance that they don't break apart.