In most countries blue is more conservative and red is more liberal.
Republicans used to be blue in part, though there were no set colors really. There is a famous picture of a newscast from the 1984 election that shows the US swathed in blue for Reagan's landslide.
This changed definitively in 2000 because of the extent of news coverage on the election. There was no coordination between news networks to unify around Red for Republicans and Blue for Democrats; a momentum sort of emerged. However, there have been some explanations put forward, most notably the alliteration of red and republican that makes it more appealing.