When a stressful situation occurs, the brain's hypothalamus activates the sympathetic nervous system.
There are autonomic responses whenever there is any psychological stress condition prepares the body to fight or adapt to it. The response to psychological or physical stress activates the sympathetic nervous system and inhibits the parasympathetic nervous system.
The HPA axis or the hypothalamic-pituitary-adrenal axis responds to stress by releasing cortisol which influences metabolic, immunological and psychological functions. The HPA axis is regulated by several regions of the brain such as prefrontal cortex, hypothalamus, amygdala, limbic system etc.