Where the breathing rhythm comes from
Breathing is automatic because networks in the brainstem generate the rhythm without conscious effort. In the medulla, the dorsal respiratory group is associated mainly with the drive to inhale, while the ventral respiratory group becomes active for forceful breathing and active exhalation. Pontine groups help smooth the transition between inhaling and exhaling.
These centers send signals down to the diaphragm and intercostal muscles, setting both the rate and depth of each breath, then adjust continuously based on feedback.
Carbon dioxide is the main signal
Central chemoreceptors near the medulla respond chiefly to carbon dioxide, sensed through changes in the acidity of the surrounding fluid. A small rise in carbon dioxide is a powerful stimulus to breathe more. Peripheral chemoreceptors in the carotid and aortic bodies add a response to low oxygen, which becomes important when oxygen falls substantially.
This layered control keeps blood gases stable across rest, exercise, and altitude. This is general educational information about physiology, not clinical guidance.