Indeed, surnames are a rather recent invention in the civilized world. Prior to this, people used first names and at times the town or location name.
Surnames themselves are not a recent innovation: The Roman patricians used surnames (Gaius
Julius Cæsar) in Antiquity and quite early in the Middle Ages (from the 11th century and onwards) urban patricians (Polo, de Medici, Fugger etc.) and feudal nobles (de Montmorency, von Riedesel) started using surnames. From ca. the Reformation and the accompanying better public records, we have evidence of hereditary surnames becoming common for burghers, i.e. the urban middle classes. Farmers were for a long time mostly registered with their patronymic and farm name (and the latter could change) and both urban and rural working classes (maids, labourers, servants etc.) were often just registered with first name and patronymic. Though all classes, at least in urban environments, seem to have had surnames in 18th-century Britain, France, Germany and Russia. In the Netherlands they didn't become fixed untill the 19th century, in Scandinavia not untill the 20th century. On Iceland people still don't have surnames, but just use patronymics (like Russians, but without a proper surname).
So hereditary surnames (derived from a personal nickname (
surnom in French), place of origin or habitation, occupation, patronymic or just ornamental / totemistic (as in Sweden and Russia) are a rather ancient phenomena, but its usage among the lower classes is a rather recent development.
Well-known example from Thuringia / Hesse:
The Reformator Martin Luther, born 1483 in Eisleben, was the son of the burgher Hans Luder, born 1459 in Möhra in Thuringia, where the Luder / Lüder / Ludter / Lauter family had lived since ca. 1300, when a knight called Wigand von Luder, i.e. Wigand from Luder, today Großenlüder, by Fulda in Hesse, settled there.
Well-known example from the Palatinate:
US President-elect Donald Trump's grandfather Friedrich Trump hailed from from Kallstadt in the Palatinate, where the Trump / Drumpf family had lived since 1608, when a lawyer called Hanns Drumpf (probably meaning "drum") settled there.
Although the surnames of many upper and middle class Central European and American families easily can be tracked back to the Reformation, it should be noted that surnames were alot more volatile the longer you go back: Consider the patrician, Knickerbockerish near-namesakes of Trump: The Dutch admirals Tromp. (Admiral Cornelis Tromp of Trompenburgh was even made a Danish count of now-Swedish Syllisborg / Sölvesborg, a somewhat more patrician argument for Trump's earlier claim of Swedish ancestry (substituting Karlstad for Kallstadt). Admiral Maarten Harpertszoon Tromp, born 1598, was the son of the naval officer Harpert Maertenz(oon) and he or his father assumed the name Tromp, derived from one of their ships called Olifantstromp, the Elephant Trunk.