Soap is made up of two-sided molecules. One side is attracted to water; the other side is attracted to fat. All viruses are bits of genetic code bundled inside a collection of lipids and proteins, which can include a fat-based casing known as a viral envelope.
When viruses interact with soap, that fat coating gets ripped out by the soap molecules. Soap literally demolishes viruses. Destroying an enveloped virus takes less effort than their non-enveloped compatriots. 20 seconds is required for this effect to happen. Experts recommended using milder soaps, like dish soap, to easily sanitize a surface indoors and outdoors. Hand sanitizers work like soap by busting apart the proteins contained in a virus.
Source: vox.com, nationalgeographic.com