Oil is a hydrophobic viscous liquid. That is, it is immiscible with water and lipophilic (miscible with other oils or fat loving). It is neutral and a non-polar liquid.
Oil floats on top of water because of the polarities of these two substances.
Water is polar and oil is non-polar in nature. Hence, there will not be any attraction between their molecules. Most non-polar molecules are water-insoluble at room temperature.
This accounts for the formation of separate layers of oil and water and their immiscibility.