Read here for a more complete description
Although for the general public wearing a surgical mask or similar does not provide protection from the possible exposure to the virus of COVID-19, It provides some level of protection to the bearer, but most importantly it protects others from possible emission of virus particles by the bearer who might be unaware of being infected.
Moreover wearing a mask hinders the possibility to touch mouth and nose and thus facilitate the intake of viruses that the hands may have collected touching contaminated surfaces.
Most importantly, everyone should avoid as much as possible situation where it is better wearing a mask. The large public should absolutely avoid those situation and use a mask always when exposed to situations requiring it because of primary necessities, such as food supply.
Here you can find a few simple guidelines. In China most people follows this simple points.