Phlegm naturally drains down into the back of the throat and can be swallowed without imposing health risks. Once in the stomach, the acids and digestive system will remove the phlegm and get rid of the germs in it. In some cultures, swallowing phlegm is considered a social taboo, being described as disgusting or unhygienic. One Igbo adage, for example, uses the swallowing of phlegm as a metaphor for wrongdoing. Also, due to the social image of spitting (the alternative of swallowing) in some communities, females were shown to be more likely to swallow phlegm and less likely to report experiencing it.
Phlegm (/ˈflɛm/; Ancient Greek: φλέγμα, phlégma, "inflammation", "humour caused by heat") is mucus produced by the respiratory system, excluding that produced by the throat and nose passages. It often refers to respiratory mucus expelled by coughing, otherwise known as sputum. Phlegm, and mucus as a whole, is in essence a water-based gel consisting of glycoproteins, immunoglobulins, lipids and other substances. Its composition varies depending on climate, genetics, and state of the immune system. Its color can vary from transparent to pale or dark yellow and green, from light to dark brown, and even to dark grey depending on the contents. The body naturally produces about 1 quart (about 1 litre) of phlegm every day to capture and clear substances in the air and bacteria from the nose and throat.
I don't get much into it with religious types about how rational their things may be. My guess is it was the result of some sort of one upmanship in some time past and became a thing.