Step 1: Structure of soap molecule.
A soap molecule consists of a long non-polar hydrocarbon tail and a polar ionic head.
Step 2: Action of soap on oily dirt.
The non-polar hydrocarbon tail dissolves in oil or grease, while the polar head remains in water.
Step 3: Orientation of soap molecules.
While dissolving oil, the hydrocarbon tail goes into the oil and the hydrophilic head stays away from the oil.
Step 4: Conclusion.
Therefore, the hydrocarbon part of soap dissolves in oil, keeping the head away from the oil.