The very first traffic light, installed outside the Houses of Parliament in London in December 1868, had red and green gas lamps for nighttime use. The device was pretty crude, and less than a month after it went operational, it exploded and killed the unfortunate traffic cop who was operating it.
Continue reading this post at Mental Floss. In short, red and green were borrowed from the railroad industry which used several colors to indicate different conditions. Red and green were used by other heavy industries of the time, green usually indicating machinery was operating, red that it had or was stopped. Why were those colors used on machinery control panels? Now that is the right question.