The anatomy of breathing uses a number of muscles to change pressures inside the thorax and adds more muscles and more movements when we need more air. At rest you're just using your diaphragm and the elastic recoil of the lungs themselves, when you're a little more active and running around the intercostal muscles start to move the ribs, and when you really need to pull air in and push it out you can take advantage of accessory muscles of respiration that might not normally move the ribs.