The main job of the lungs is gas exchange, pulling oxygen into the body and getting rid of carbon dioxide.
Normally, during an inhale - the diaphragm contracts to pull downward and chest muscles contract to pull open the chest, which helps suck in air like a vacuum, and then during an exhale - the muscles relax, allowing the lungs to spring back to their normal size pushing that air out.
When you breathe in, air flows through the nostrils and enters the nasal cavity which is lined by cells that release mucus.
That mucus is salty, sticky, and contains lysozymes, which are enzymes that help kill bacteria.
Nose hairs at the entrance of the nasal cavity get coated with that mucus and are able to trap large particles of dust and pollen as well as bacteria, forming tiny clumps of boogers.
The nasal cavity is connected to four sinuses which are air-filled spaces inside the bones that surround the nose, called the paranasal sinuses.
There's the frontal, ethmoid, sphenoid, and maxillary sinus.
Those sinuses help the inspired air to circulate for a bit, so it has time to get warm and moist.
The paranasal sinuses also act like tiny echo-chambers that help amplify the sound of your voice, which is why you sound so different when you plug your nose or if they're clogged with mucus during a cold!
So the relatively clean, warm, & moist air goes from the nasal cavity into the pharynx or throat, the region connecting the two is called the nasopharynx, and the part connecting the pharynx to the oral cavity is called the oropharynx.