Fever occurs as a part of the body's natural defense mechanism. When the immune system detects pathogens, it releases chemicals called pyrogens into the bloodstream. Pyrogens travel to the brain and signal the hypothalamus to increase the body's temperature set point. The elevated temperature creates an environment less favorable for the growth of many pathogens, aiding in the fight against infection.