John Hertz (later of Hertz Rent-a-Car fame) wanted to create a cab company with low prices so the common man could afford to ride in them. Yellow Cab was founded by Hertz in 1915 using surplus stock from his car dealership.
Hertz decided that yellow was the best colour for his cabs to be painted because a survey by the University of Chicago concluded it is the easiest colour for humans to see. Before long, he had. painted all of his cabs yellow, starting a tradition that continues to this day.
New York cabs were originally coloured red and green but later repainted yellow so they were visible from a distance.