Soap contains fat-like substances known as amphiphiles, some of which are structurally very similar to the lipids in the virus membrane. The soap molecules “compete” with the lipids in the virus membrane. This is more or less how soap also removes normal dirt from the skin.
The soap not only loosens the “glue” between the virus and the skin but also the Velcro-like interactions that hold the proteins, lipids and RNA in the virus together.
Alcohol-based products, which pretty much includes all “disinfectant” products, contain a high-percentage alcohol solution (typically 60-80% ethanol) and kill viruses in a similar fashion. But soap is better because you only need a fairly small amount of soapy water, which, with rubbing, covers your entire hand easily. Whereas you need to literally soak the virus in ethanol for a brief moment, and wipes or rubbing a gel on the hands does not guarantee that you soak every corner of the skin on your hands effectively enough.
So, soap is the best, but do please use alcohol-based sanitizer when soap is not handy or practical.