In animals, the lungs are the area where gas exchange takes place. Without gas exchange, oxygen would not pass into the blood from the lungs so the body cells would not be able to receive the oxygen needed for respiration.
The alveoli are moist to allow oxygen to move from the lung through the alveoli into blood vessels and red blood cells. Carbon dioxide passes from the blood into the alveoli. The oxygen-filled blood goes back to the heart and the carbon dioxide in the alveoli is pushed out of the lungs and into the air we breathe out.
Birds lungs are smaller than mammal lungs, and do not have alveoli, instead they have millions of para-bronchi. These para-bronchi end up in tiny capillaries or very small blood vessels and they pass close to the body's blood vessels, so diffusion can occur and the oxygen and carbon dioxide is exchanged. The oxygen and carbon dioxide in birds lungs are continuously diffused into and out of the blood, not like in mammals where diffusion can only happen in the alveoli. Air does not go into and back out of the lungs as in mammals. Instead, muscular air sacs push the air forward through bird lungs.