One of the main reasons that your body aches when you are sick, like with a cold is that your body's immmune system is producing plenty of anti-bodies.
These anti-bodies also produce histamines which typically dilates (widens) blood vessel near an infection, this allows for more of the body's defences to get at the infection. There are histamine receptors in blood vessels that cause them to dilate. As these chemicals ae released into your blood stream they can end up in your muscles or other body parts. Various body systems can have receptors to histamine that can then trigger a pain receptor.
In addition to histamines there are biochemicals called cytokines that are released when the body has an immune response that are also known to trigger a biochemical pathway that can affect pain receptors.
Histamines and cytokines releases can change the perception of pain receptors in the body making them more sensitive to pain factors.
There are other factors that come into play also such as biochemicals called interleukins that relate to fever conditions and temperature increases, all of which can affect pain receptors in different ways, for example heat receptors.
The overall perception of pains and aches over the whole body can vary from person to person and there may be other combinations of psychological, physiological or even nutritional factors that may influence this.
Note to reddit TIL:
The original/older version of this page referred to muscle contraction and lactic acid as being a reason for muscle aches, this is not a major reason for such pain in a flu like situation. That information has been removed and the page up dated since.
- Role of histamine H(1) receptor in pain perception: a study of the receptor gene knockout mice.
- Cytokines, Inflammation and Pain (US National Library of Medicine )
- Molecular Pathways in Virus-Induced Cytokine Production (Microbiol Mol Biol Rev. 2001 March; 65(1): 131–150.)
- Symptom pathogenesis during acute influenza: Interleukin-6 and Other cytokine responses
- Types of pain receptors (PDF, technical notes, Texas A&M Univeristy, S.E Reichman)