As the diaphragm flattens, the volume of the chest walls expand out and increase. The intrapleural space increases in volume as well which decreases the pressure in this space. Since the air in the lungs is still at atmospheric pressure, but the pressure in the intrapleural space has dropped, the lungs expand into the intrapleural space which drops the pressure in the lungs. Air rushes into the lungs due to the pressure differential. When the diaphragm relaxes, air is pushed out by the reverse mechanism.