I've written the question vaguely so as to encompass "restaurants" (eat on the food preparer's premises), street food (eat at the point of purchase), and "take-out" (take with you to eat on your own premises). I'm also excluding preparing lots of food for long-distance trade or travel. How far back do references to such activity go, and/or are there indications that it predates any record?
Food service (in the sense of preparing food for others to eat) probably dates back farther than recorded history. Sellers of ready-to-eat food in marketplaces are recorded as far back as Sumer.
Fast food becomes a giant industry in the urban areas of the Roman Empire. Most of the population lives in insulae, small apartments that get smaller the higher up you are. These rarely have cooking facilities more complex than a coal brazier and strict laws were in place against lighting fires indoors to prevent you from burning down the city block. The exact distinction between a taberna, thermopolium, and popina are sketchy and not well known, but all three were names used for a place that sold food, wine, and optionally had lodging. You could get both hot foods (stews, cooked sausages, roast and boiled meat, etc.) and "bar snacks" (dried chickpeas and vegetables) at different locations. Rome also had a street food scene with carts and stands selling food as well. Only the wealthy who had individual houses would have a kitchen, with its own staff (usually slaves).
This would continue in urban areas for centuries. It wouldn't be until around the time of the Industrial Revolution that average people could reliably cook in their apartments, with the invention of more reliable ovens and eventually stove tops. Even the White House didn't switch from a hearth to an iron stove until the Fillmore administration, which should tell you something about how everyone was doing their cooking at the time!
The same applied outside of Europe as well. Egypt under the Mamluks fed its populace with street food, most prominently the national dish of ful medames (mashed fava beans in olive oil, plus whatever else you've got handy). Giant cauldrons warmed over the coals left over from heating bathhouses would serve up the hungry citizens every day from sunrise to sunset. Meat was also sold, including non-halal food like dog or carrion passed off as halal. Song Dynasty China is most famous for inventing the "restaurant" in the sense of a place where you would sit down, have a waiter come to you, and order off a menu.
About 400 years later is when you'd get the word "restaurant." As you could guess from thinking about the name, French restaurants initially sold restoratives in the form of soups and broths, meant for health. They initially had conflicts with the strong cook-caterer guilds who attempted to legally restrict what kinds of food they could sell, but prevailed in the 19th century in the name becoming synonymous with food service.