If I’ve got this right, the custom used to be that whenever election results were displayed, “Blue” was used to represent whichever party included the incumbent president, and red was used for the other major party. In 2000, the democrats were blue, because Bill Clinton was the incumbent president. However, the Blue versus Red theme ran so strong in that election, that the association of blue with democrats, and red with republicans became something that the media decided to just go with.
My impression was it used to be red for democrats until they complained that it was a way to suggest they were communists and it got switched (since nobody associates the republicans with communist)