Soap molecules have one side that is hydrophilic and one side that is hydrophobic which allows it to bond with and dissolve in both water and oils - which is why soap helps the water clean better. One end sticks to the water, and the other end sticks to the oils/grease that you want to clean off.

