Washing is all about removing dirt and stains from materials. There are many ways this can be done. In some cases, simply washing in water can do the trick. That is because some materials dissolve in water. However, many materials in dirt are greasy, and grease does not dissolve in water. As a result we use a detergent. A detergent contains a substance that will dissolve in water, but which also attracts grease. As a a result, the grease is attracted to the detergent and pulls away from surfaces and goes into the water where it can be washed away.
Detergents do not work very well at low temperatures, and washing powders, for example, have to be used in temperatures of 30°C or more.
Because grease is stuck to surfaces, the detergents will not work unless they are rubbed against the grease. This is why you have to scrub by hand or put soiled materials in a washing machine.