Because the sensation of taste is closely tied to your sense of smell. The combination of your taste buds and the smell of food is what makes your brain recognize a taste. When you have a cold, your nose gets clogged and you can't smell as well as you normally can, so in your head, foods don't taste the same because you're not getting the normal amount of "taste information" from your nose"
This is also why people hold their nose when eating something they don't like and why inhaling when you're eating spicy food makes them seem spicier.