Why do infants get fevers?

Infections. Fevers are part of your baby's way to fight off infections. But in infants, fevers can signal a serious infection, like an urinary tract infection or bacteremia, a bacterial blood infection. If your infant has a fever, he or she may need lab tests to determine if they are at risk for these infections. For older children, fevers are not as worrisome, unless they last for longer than 5 days.
Immune response. Fever is part of the bodies "immune" response to getting infected, and is actually useful to help prevent the germs from multiplying. Other parts of the immune response include development of antibodies to fight the infection, but that takes much more time than developing a fever.