Soap dissolves easily in water because part of its molecular structure is attracted to water molecules. This means that when soap is immersed in water, the attraction pulls these molecules away from each other, bonding them and dissolving the detergent.
The structure of water and the nature of hydrogen bonding creates an electrical field around the molecule. Essentially, a water molecule is a magnet, complete with opposing charges on either end of the molecule. This difference in charge allows water to pull other molecules apart, effectively dissolving the material.
Soap takes advantage of this property by having a unique molecular structure. One end is hydrophilic, strongly attracted to water. The other end is hydrophobic, and is more attracted to the molecules that make up oil and grease. When soap dissolves in water, the hydrophilic end bonds with water molecules, both dissolving the soap and reducing the surface tension of the water, forcing the water molecules apart and allowing them to soak into dirt and grime easier.
When the bonded molecules encounter oil or grease, the hydrophobic ends attach to the molecules of grime, eventually surrounding the contaminant with a bubble of soap and water. This prevents the oil from bonding to whatever surface it was touching and washes it away.