Oxygen and carbon dioxide move between air and blood by simple diffusion – moving from an area of high partial pressure to an area of low partial pressure. The highest concentration of oxygen is in the air, the lowest concentration is in those cells using oxygen and glucose to make energy. Whereas for carbon dioxide it is the reverse – as a by-product of generating energy there is a higher concentration of carbon dioxide in the blood compared to the air.
This pressure gradient is why oxygen diffuses into the blood and carbon dioxide diffuses out into the air when we breathe.
Here is a simple equation of this process: