Soap has two ends.
One hydrophillic and other hydrophobic
Hydrophillic end: Water attracting head. Soluble in water.
Hydrophobic tail: Water repelling tail.Non soluble in water but soluble in grease and oil.
When a dirty cloth is treated with water solution,The hydrophobic tail dissolves in the oily dirt and the hydrophillic head stays aloft and is held by the surrounding water.As a result spherical ionic soap micelles are formed.
With the greasy dirt lying at the centre of the micells, That is soap is attracted by both greasyy dirt and water. This lowers the surface tension of water and a stable emulsion of oil in water is formed.
Thus when the surface of the cloth is scrubbed,beaten on stone or with a ladle,the loosened oily dirt gets chucked out.And the cloth is cleaned!
Mark the the best! :D