The diaphragm flattens and moves downwards and the intercostal muscles contract, moving the rib cage up and out. This increases the space inside the thoracic cavity. This reduces the pressure because there are the same amount of particles in a bigger space, and so the particles are less likely to collide. A pressure gradient is set up from the higher atmospheric air pressure to the lower thoracic pressure inside the body, so air moves down a pressure gradient into the lungs.