The primary purpose of the masks is to reduce the amount of viral transmission FROM infected persons. They can provide some very limited protection from getting it, but they’re mostly to prevent it from being spread.
Most COVID-19 cases are either asymptomatic or have very mild symptoms easily confused with allergies or a minor cough or cold. People who largely feel fine go out in public. If they’re infected with SARS-CoV-2, then every word spoken, every random cough (sometimes you just have a tickle in your throat) or sneeze, every strong exhalation of any kind is pouring virus-filled droplets out into the air. If you have a mask over your nose and mouth, most of those droplets are captured. The virus denatures when it’s not in a droplet, so if you stop the droplets, you stop the virus. If it can’t get past your mask, it can’t infect people.
Take a look at Figures 6-9 here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7301882/
Thanks for posting, now I understand