The brain stem and its individual components, the medulla, pons and midbrain, are in control of breathing and the respiratory system's various parts. The main section of the respiratory system responsible for breathing, or specifically inhalation, in the brain stem is the dorsal respiratory group, which is in the medulla.
The dorsal respiratory group fires neurons in bursts, causing the muscles involved in the inspiratory muscular group to contract. When those muscles relax, the body exhales. The brain stem is in control of other vital functions as well, including the heartbeat and blood pressure. When you need to force air out, like when talking, the ventral respiratory group takes over. The amount of air that is taken in is regulated by the pneumotaxic area in the pons part of the brain stem.