If you have a cold or any other signs of flu, fever or muscle aches, then it is best to go in for some kind of moderate exercise such as walking. However, you should avoid intensive exercise till you are completely cured and all the symptoms have gone away.
If you are a fitness enthusiast or an athlete, keep in mind the following things about your health and immune system:
Your immune system depends on your diet so eat a balanced diet to keep diseases away.
If you are overweight, try to get rid of that extra mass, but avoid rapid weight loss. Remember low-calorie diets, long-term fasting and rapid weight loss harm the efficiency of your immune system. Further, losing weight along with heavy training is not good for your immune system.
Sleep well and enough. Sleep deprivation is bad for your immune system.
Lastly remember a fundamental of training, i.e., do not over train. Space vigorous workouts as far apart as possible. Your body needs sometime to recover and if you go past it you will get negative results. There is a limit of recovery and if you exceed that you may fall ill.
Keep this in mind and you will be able to workout without any problem.
Medical Update : If You're Concerned About Exercising During a Cold . . . : Edwin W. Brown, M.D., M.P.H.
Healthy immune systems can cope with mild infections without being compromised by moderate workouts. A recent study found that such workouts neither helped nor hindered the length or severity of colds--although some researchers think that mild exercise may stimulate the immune system. Vigorous workouts, however, may worsen the situation, as demonstrated in animal studies. If you have a cold and still want to work out , begin at about half your normal intensity , then pick up the pace slightly if you still feel OK. In any case , don't go through your full normal routine. However , don't try it with such more serious infections as pneumonia , bronchitis , influenza , etc. , even if you don't feel too badly--which isn't likely! Any amount of exercise puts a strain on the immune system in such illnesses. Even after symptoms disappear , it's best to keep physical activity down to moderate levels for at least two weeks.