This old tale may be partly based on the medieval theory of humours. The idea was that good mental and physical health depended on the balance of four body fluids, called humours: black bile, yellow bile, blood and phlegm. A fever indicated an excess of blood, and the treatment included bleeding the patient -- which, in retrospect, was not such good advice. Fasting may have also been prescribed as a way to slow down what seemed to be an overcharged metabolism.
Likewise, every mucous mouthful a cold sufferer coughed up indicated an excess of phlegm. Phlegm was a wintry humour, associated with depressed spirits and depressed metabolism. The logical remedy was to stoke the bodily furnace with food, which would also lift the spirits. (This thinking may also underlie another myth: that you can "sweat out" a cold by bundling up, thus overheating the body.)
When you're sick with a cold or the flu, your body needs the nutrients of a balanced diet and energy from adequate calories to fight off the infection, especially in the early stages of illness. There's no medical advantage to undereating or overeating in either case. Staying well nourished and well hydrated is the best advice.