People wear masks so that they can protect themselves from inhaling polluted air.
Nowadays, there are so many vehicles on the road that produce smoke. Also, there are numerous factories which release smoke into the atmosphere which is bad for health. The quality of air in some places is so bad that we cannot breathe that air. Therefore, to avoid breathing dust particles and other particulate pollutants, some people wear the mask.