In complex life forms (mammals) gaseous exchange occurs through the process of breathing. When humans for example breathe in we take in oxygen into our lungs.
Through the gaseous exchange mechanism, oxygen diffuses through the cell walls of the alveoli and gets into the bloodstream. The blood rich oxygen is taken to the cells where it is needed for respiration occur.
The process of respiration produces the gas carbon dioxide. This waste product must be removed from the cell because it is toxic.
The carbon dioxide diffuses out of the cell and gets into the bloodstream and taken to the lungs. In the lungs carbon dioxide diffuses into the trachea and is exhaled.