In short, water and oil don’t mix because they are two substances with different types of molecules. The structure of oil’s molecules makes it hydrophobic, so it won’t mix with water’s molecules.
Water is a polar molecule, meaning the amount of electrons in the hydrogen and electronegative oxygen is unequal. The result is the bent-shaped molecule having a positive charge on the hydrogen and a negative charge on the oxygen. This means that water is a polar solvent. So just hydrophilic (hydro meaning ‘water’ and philic meaning ‘loving’) substances will combine with water.
Oils are comprised of hydrocarbon chains or chains where carbon atoms are bonded to hydrogen atoms. The configuration of oil molecules makes them non-polar and hydrophobic (meaning they avoid water).
“Like dissolves like” is a saying that explains the way a solvent will react to a solute. Polar solutes will dissolve in polar solvents, and only non-polar solutes will dissolve in non-polar solvents.
This explains why oil and water don’t mix. If you were to use emulsifier, you could get oil and water to mix together.
An emulsifier is a substance that has one end that is polar and the other end that is non-polar. Emulsifiers are usually surfactants and long molecules. The non-polar ends will border an oil molecule to make submicroscopic units termed “micelles” containing non-polar cores and polar exteriors. Because of their polar exterior, micelles are will mix with water. The molecules will still have a different density when compared to water, but they will be spread throughout the solution. The density of this new solution will have a different density than water.
Relative density isn’t related to the miscibility properties of oil in water, but it does explain why oil will layer on top of water when they’re not mixed.
Follow this link for more information about the chemical process of solution: