Solution 1:

We can precede cold with both a and the when we make a generic reference, as in ‘A cold can be difficult to get rid of in the winter’, and ‘The common cold is found everywhere in the world.’ In conversation we use a cold when we introduce it as a new topic of conversation (‘I’ve got a cold’), but the when we refer to it once it’s been mentioned (‘How long have you had the cold?’)

The reason why we say, or can say, the flu in contexts where we have to say a cold has its origins in the word’s history. Influenza is an Italian word having the basic meaning of ‘influence’, but which came to mean ‘visitation’ and ‘outbreak’ and then ‘epidemic’. Its first recorded use in English was in 1743:

News from Rome of a contagious Distemper raging there, call'd the Influenza.

The definite article has been possible ever since. In actual fact, influenza occurs mostly with the zero article, as this nGram shows.

Solution 2:

Because there are many colds, but only one flu. The flu has always been considered a disease, but it is only very recently that the cold has also been considered so. Originally, catching a cold was believed to be just something that happened to you based on enviromental conditions - like a headache. Even now, worried parents will warn their children that if they get cold and wet, they are likely to catch a cold, which we now know to be entirely incorrect.

So every cold was a separate thing, unique to the person who had it - saying "I've got the cold" would be like saying "I've got the headache". A case of the flu on the other hand was NOT separate, but a part of the larger flu outbreak.