Restaurants or at least eating outside of your home has a long history. In the by an volcano outburst disaster struck Pompeii, archaeologist found more then 150 "snack bars", which means roughly 1 snack bar per 75 people, which is more then most urban cities have.
The restaurant in the USA was established in Boston, by an early settler in 1634. The oldest restaurant in New York City that is still in operation is from 1762.
When modern times slowly kicked in, for lot of people it was cheaper to eat in central place then cooking there own dishes and using precious woods or other fuels to cook a meal. Restaurants in those times were for the poor people, why rich people eat at home, their meals served by kitchen staff.
From serving the poor to food for the rich
When times went on eating food in restaurants become in the west something for the rich people, where in 1930 a meal in a restaurant was 25% more expensive then eating at home, in 2014 that became 280% more costlier.
Restaurant in many countries are a window to the world and migrants who are bringing their own food culture to their new home country play a big role in the industry.
Extract from The economic history of restaurants - The Economist