The structure of soap is such that its molecules can simultaneously capture both water molecules and fat molecules, working as a kind of cohesion. This property of soap is called surface activity. Thus, when we apply soap to the surface of the skin, it removes oil particles along with the water that we apply along with the soap. And along with them, various bacteria float into the sewer pipe. Accordingly, the longer you wash your hands, the less grease and germs remain on them.
This method of fighting microorganisms is one of the most effective. Even if you buy an antibacterial soap, its effectiveness will hardly be higher than ordinary soap: after all, the antibiotics included in the composition will only act on certain groups of bacteria. If you make your own soap, you can add glitters there https://varenie5.ru/glitery-perlamutry
Soap itself has never had disinfecting properties.
Soap molecules are oblong, one end is hydrophobic (in fact, it is fat, it does not mix with water, but it adheres well to dirt), the other end hydrophilic (that is, it attaches to water). When we wash our hands or wash clothes, elongated soap molecules stick around the dirt particles, at the ends of which water flows later and "rip" the dirt from the surface. After that, the dirt (covered with soap) can no longer cling back to the skin or tissues. The same thing happens with grease on the dishes.
Soap, dissolving in water, reduces its surface tension coefficient, this makes the water more liquid, allows it to penetrate deeper, for example, into rough surfaces and wash away dirt from there, and also promotes the formation of foam.
Many manufacturers are now adding to soaps and disinfectants, although in my opinion there is more marketing than real health benefits (doses are small). The body is not a fool and will calmly cope with the microorganisms remaining after washing on the hands. And if you still urgently need an effective disinfection, wipe your hands with alcohol, for example.
As for history, soap was known as far back as other Egypt and Babylon. It was made by mixing animal / vegetable fat with ash. Ash has now been replaced with something else, but fat is still used almost everywhere as a base.
Interested in the mechanism of action.