When your body temperature rises because of an infection, it's called a fever. Fevers are caused by chemicals called pyrogens flowing in the bloodstream. Pyrogens make their way to the hypothalamus in the brain, which is in charge of regulating body temperature. When pyrogens bind to certain receptors in the hypothalamus, body temperature rises.
One common pyrogen is called Interleukin-1 (IL-1). IL-1 is produced by white blood cells called macrophages when they come into contact with certain bacteria and viruses. IL-1 has multiple purposes, one of which is to signal other white blood cells, called helper T cells, into action.
One purpose of a fever is thought to be to raise the body's temperature enough to kill off certain bacteria and viruses sensitive to temperature changes. One interesting debate right now, therefore, is, "Should you lower a fever?" Aspirin, for example, will reduce fever; but if the fever is actually helping rid the body of infection, then lowering it might not be a good idea. On the other hand, people sometimes die from fever. Right now the general medical consensus falls on the "reduce the fever" side of the fence.