A soap molecule has an amazing characteristic. If you placed soap molecules directly between a layer of fat and a layer of water, all the soap molecules would flip so the oil loving part of each molecule pointed towards the oil and the water loving part of each molecule pointed towards the water layer. This doesn't really happen in real life but something just like it does. When oil is placed in soapy water, the soap molecules break the oil into billions of microscopic droplets. Surrounding each droplet are 20 million soap molecules creating a soap film 1 molecule thick.
Many people incorrectly think soap dissolves oil.
Rather, it puts the oil in a fine suspension in the water, more correctly called an emulsion. This permits the water to 'wash it away' from whatever is being cleaned. For soap to work, it must be agitated to emulsify the fats. The hydrogenation of fat was first developed for the soap making industry in the late 1800's because of a shortage in animal fats. The unhealthy idea of eating them came later.