When we breathe in, the diaphragm contracts and flattens pushing down on the abdominal organs. At the same time, the external intercostal muscles contract pulling the ribcage upwards and outwards. As a result, the volume inside the thorax increases so there is less pressure here compared to outside. Air rushes in to fill this space.