Such a molecule is called an emulsifier, or, more simply, a soap. When you get a soap molecule in there, the water and the oil stick to it, and then the oil and water mix. A lot of things can be emulsifiers. Soap is one of them. But if you put soap on your hands, the grease will mix with the water, and come off.
Egg yolks are another thing that works.
You can make some with oil, vinegar, and eggs in your blender at home. Water is a polar molecule which means that it has a negatively charged end and a positively charged end. So water molecules attract each other. They also attract other polar molecules. Oil is NOT a polar molecule-it doesn't have a separation of charge.