Hm. Surprised at the low level of anthropology here. Lots of value judgements on both sides, but not a whole lot of history.
OK. The answer is tied up with patrilocality. See for example Why did society shift to patrilocality after the Neolithic agricultural revolution? And Patrilocal residence on Wikipedia.
Patrilocality is the arrangement where, when a woman marries a man, they don’t go off and make their own household: they stay with the household the man belongs to.
If you’ve just invented agriculture, and you rely on access to land for subsistence, then patrilocality makes a lot of sense. You don’t want to keep splitting up the family farm with every generation of kids, until it’s down to a postage stamp; and you don’t want to give a bit of the farm away to someone who isn’t going to stick around and help farm it. Patrilocality makes a lot of economic sense; it’s only in the modern, post-agricultural West that it makes any sense for new families to establish their own households.
Of course, patrilocality is not the only way of resolving the issue of how to keep the family farm in one piece. You can also have Matrilocal residence, where the couple stays with the household the woman belongs to. But that doesn’t mean that matrilocal societies are feminist paradises. From what Wikipedia tells me, in many matrilocal societies, the husband stays with his family, and only visits the wife “in their spare time” (so he can still tend to his parents’ farm). The father is disinherited from his own children (who stay with the mother)—but brings up his sister’s children (who are staying with their mother); so the family farm still stays together.
In any case, even if these practices start out because they make economic sense, they are perpetuated as tradition and value judgements. When Bing Sanchez (who lives in Greece) told me she was going to ask a variant of this question, I asked her to ask around for the definition of a sogambros.
Greece is traditionally a patrilocal society. A sogambros, literally an “inside son-in-law”, is matrilocal: he’s someone who’s living with his wife’s kin, instead of his own.
Traditionally, this is considered embarrassing.
There’s nothing rational about the embarrassment in modern society; in fact, there’s nothing rational about it even in traditional society. But the social pressure helps maintain patrilocality, and having either consistent patrilocality or consistent matrilocality is rational: everyone knows the rules, no scope for inheritance disputes (which would turn deadly in a subsistence economy), and the family farms stay intact.
What’s all that got to do with surnames?
The group identity of an extended family originates in the bunch of people who have the family farm in common, through inheritance. In patrilocal societies, that inheritance is from father to son.
Ditto surnames. Having the same surname means you’re part of the group who gets to farm the same family farm.
It’s as simple as that. And if you’re getting married into the family farm as a woman, you take the family’s surname, because you too will be tending to the family farm.