Our lungs supply oxygen from the outside air to the cells via the blood and cardiovascular system to enable us to obtain energy. As we breathe in, oxygen enters the lungs and diffuses into the blood. It is taken to the heart and pumped into the cells. At the same time, the carbon dioxide waste from the breakdown of sugars in the cells of the body diffuses into the blood and then diffuses from the blood into the lungs and is expelled as we breathe out. One gas (oxygen) is exchanged for another (carbon dioxide). This exchange of gases takes places both in the lungs (external respiration) and in the cells (internal respiration).
During inhalation, each alveoli receives air that contains various gases: nitrogen (almost 80%), oxygen (almost 20%) and other gases including 0.04% carbon dioxide. External gaseous exchange then takes place, using the principle of diffusion:
Oxygen diffuses from the alveoli into the pulmonary capillaries because there is a high concentration of oxygen in the lungs and a low concentration in the blood;
Carbon dioxide diffuses from the pulmonary capillaries into the alveoli because there is a high concentration of carbon dioxide in the blood and a low concentration in the lungs;
Nitrogen diffuses both ways.
An easy way to put it we breathe in high amounts of oxygen which then diffuses from the lungs into the blood, while high amounts of carbon dioxide diffuses from the blood into the lungs, and we exhale. Once in the blood, the oxygen is bound to hemoglobin in the red blood cells, taken to the heart, pumped into the vascular system and then taken to all the cells of the body.