Cleveland, Ohio is widely credited with having them first traffic light. James Hoge, an engineer, in 1914 connected the first traffic light to the overhead power system, using the red and green lights already familiar from railways. The light was controlled by a policeman in a booth nearby, who flipped the switch between red and green. The yellow light came later; it was an invention of William Potts, a Detroit police officer.
Technically, there were several experiments with traffic lights prior to Hoge’s success in Cleveland, but none were as successful as he was.