Complex molecule of detergent have two ends i.e., hydrophobic and hydrophilic. These two ends make it able to break through the surface tension of water. The end of the detergent molecule which is attached to oil and grease tries to get detach from water molecule. It is known as a hydrophobic. By trying to move away from the water molecules, the hydrophobic ends of the detergent molecules push up to the surface. This weakens the hydrogen bond of the water molecule.
In this way detergent breaks the water surface tension and remove the oil and dirt.
Regards