This is the History of American Diners according to Bill Bryson's "Made In America".
One Walter Scott started selling sandwiches from a wagon parked outside the offices of the Providence Journal (Providence, Rhode Island) in 1872. When he retired 45 years later, the town was full of sandwich wagons. Scott alone had 50 competitors in Providence.
The funny thing is that those wagons were generally called lunch wagons, although lunch was the only meal they did not serve. Government being what it is (even in those times) soon started to enact bans on lunch wagons, which led their operators to simply take off the wheels, and call them restaurants. Already in the 1920s a number of companies were mass producing those new "restaurants", already widely known as "diners".
Apparently you could make a profit of around 12,000$ with a single diner per year, which was a hell of a lot in the 1920s.
It seems that there is a myth that diners were made from old railway cars. This is not true. They were just made to look (almost) like railway cars.