Fats and oils are not soluble in water because they are non-polar while water is polar. Polar substances tend to dissolve in polar solvents, while non-polar substances dissolve in non-polar solvents. Polar substances are known as hydrophilic (water-loving) and non-polar substances are hydrophobic (water-fearing.)
Soap consists of long molecules that have a polar or hydrophilic end that is an alkali metal ion and a non-polar or hydrophobic end that is a fatty acid. The hydrophobic end is attracted to grease and oil. An oil particle will become surrounded by soap molecules which have their hydrophobic ends near the oil droplet and their hydrophilic ends pointed outward. This results in a spherical-shaped particle called a micelle, whose outer surface is now soluble in water due to the hydrophilic ends of the soap molecules.
Soap is made from the chemical reaction of fats and lye (NaOH) or potash (KOH). Each of the three fatty acid chains from each fat molecule bonds to a Na+ or K+ ion, producing three soap molecules. Glycerol (glycerine) left over from the fat molecules is a by-product of the process. This process is called saponification.