Your diaphragm goes up (decreasing the amount of volume your lungs take) increasing pressure. Then, your lungs have higher air pressure than the atmosphere around you. The carbon dioxide diffuses from your lungs as you exhale. Then, your lungs are empty. When you inhale, your diaphragm lowers, decreasing the pressure. The air diffuses (having a higher pressure than your lungs) into your lungs.
-- derived from Boyle's law (gas diffuses)