I am a curious person and the science of how things work has always fascinated me. The following explanation is for those who share my curiosity.
Soap, water and oil are all made up of molecules. Some molecules are hydrophillic, (hydro=water and philic=loving) these molecules are attracted to water. Some molecules are hydrophobic, (hydro=water and phobic=fearing), they are repelled by water. Molecules that readily mix with water are hydrophilic. Molecules that readily mix with oil are hydrophobic. Since we all know that water and oil do not mix, then we also know that hydrophilic and hydrophobic compounds do not mix.
Two other words we need to know are polar and nonpolar. Nonpolar compounds, like oil and grease, cannot dissolve in water. Polar compounds can dissolve in water.
Most of what we call dirt is grease or oil which will not come off with just water. This is because oil and grease are non-polar, which means they will not dissolve in the water.
Soap can mix with both water and with oil. Why? The soap molecule has two different ends, one that is hydrophilic (polar head) that binds with water and the other that is hydrophobic (non-polar hydrocarbon tail) that binds with grease and oil.
The Interactive Library edinformatics.com
When greasy dirt is mixed with soapy water, the soap molecules arrange themselves into tiny clusters called micelles (pictured on the right).
The water-loving (hydrophilic) part of the soap molecules sticks to the water and points outwards, forming the outer surface of the micelle.
The oil-loving (hydrophobic) parts stick to the oil and trap oil in the center where it can't come into contact with the water. With the oil tucked safely in the center, the micelle is soluble in water. As the soapy water is rinsed away the greasy dirt goes along with it. Micelle Picture from Wikipedia
You can think of soap as the middle-man that helps bring oil and water together so that the dirt and grease on your skin can be easily rinsed away.