Wikipedia, the story goes:
...On a particularly hot day, Mr. Green ran out of ice for the flavored sodas he was selling and used vanilla ice cream from a neighboring vendor to keep his sodas cold. His own account, published in Soda Fountain magazine in 1910, states that while operating a soda fountain at the Franklin Institute's sesquicentennial celebration in Philadelphia in 1874, he wanted to create a new treat to attract customers away from another vendor who had a fancier, bigger soda fountain. After some experimenting, he decided to combine ice cream and soda water. During the celebration, he sold vanilla ice cream with soda water and a choice of 16 different flavored syrups. The new treat was a sensation, and soon other soda fountains began selling ice cream sodas. Green's will instructed that "Originator of the Ice Cream Soda" was to be engraved on his tombstone...We thank you, Mr. Green! Off for a root beer float myself!