mxyzplk covered the history of the term in gaming, and Alex P has covered its history in fantasy literature (which greatly influenced gaming). I'll try to summarize the real-world context (which doubtless influenced the literature).
The word "barbarian" was really invented by ancient Greeks (Sg: βάρβαρος - bárbaros, Pl: βάρβαροι - bárbaroi), and used for people who weren't culturally Hellenic (Greeks). The word has some negative, perhaps patronizing connotations, because the Greeks tended to think that Greek culture is best. A Greek saying - "whoever isn't Greek is a barbarian" - which also applied to Romans btw.
The Romans borrowed the term and the habit from Greeks, just like many other things.
Medieval Europeans glorified ancient Greece and Rome, and when they looked back on history, it seemed to them that Greeks and Romans were indeed very advanced and civilized, and the so-called "barbarians" (Germans, Gauls, Celts, Scythians and Huns) were not.
Thus, it became fashionable to say "barbarian" when what is really meant is "savage", "uncivilized" or "uncultured". To be pedantic, one can say that using this word seriously is perpetuating Greco-Roman xenophobic propaganda, and the usage is nonsensical unless the user himself is (ancient) Greek or Roman, or referring to the views of one. But there you go. Doubly amusing is the observation that hardly any of the people that the Romans called barbarians existed by the middle ages, and the Europeans who were so fond of calling others barbarians would most likely have been considered barbarians themselves by the Romans.
Incidentally, the Chinese also had such a view (whether justified or not) of their own customs compared to their neighbors: They also had a similar opinion of eg. the Xiongnu. When western sources translate Chinese texts, sometimes the word "barbarian" is used as an equivalent - but that's a bit awkward. The (ancient) Chinese obviously thought "barbarians" are people who are not Chinese, but to the Greeks or Romans, the Chinese themselves may have appeared barbaric.
Moreover, it's questionable whether the Romans or Greeks had much contact with Xiongnu to apply the term to them, and it seems a little strange to apply this highly contextual term to people who never existed in the context of the culture that invented it in the first place.
In any case, the point is that the name of the Barbarian class is already an absurdity no matter how you slice it.
The word "berserker" was invented by the Norse, to refer to those warriors among them who would fall into a furious trance in combat. So it is a term used by the Norse to refer to a certain custom of the Norse. They were mentioned first in this verse about the battle of Harald Hårfagres at the Hafrsfjord:
grenjuðu berserkir, guðr vas á sinnum, emjuðu Ulfheðnar ok ísörn dúðu.Haraldskvæði, verse 8
the berserks screamed, the battle started, the wolfpelts yelled and swung the iron
Contrasting with "barbarian": Clearly these words are very different. "Berserker" is a classification of class, occupation, or combat style (depending on how you look at it). "Barbarian" is a classification of cultural origin. Not all barbarians are berserkers (some are just women, children, or archers) and one may be a berserker without being a barbarian - there's nothing stopping a Roman from learning the same combat tactic and applying it, assuming berserkers were actually real (although his peers may accuse him of "taking up barbaric customs").
To the Greeks and Romans, one of the most obvious things about the people they called barbarians would be their ways of doing war (since especially the Romans liked to wage war on barbarians, and liked to talk about how barbarians do war). I'm not sure if any evidence exists of "berserkers" being actually encountered by the Romans or if the word was ever used by them (although apparently they did encounter warriors who use psychoactive substances in combat), but in a fantasy world with parallels to medieval Europe, you can sort of make a case for how the "civilized nations" would see all "barbarians" as berserkers. But even in our history, it is obviously absurd to use "berserker" in conjunction with, say, the "barbarian" Huns or Mongols who most certainly did not berserk.
Relation to roleplaying
At least in DnD, a barbarian may indeed go berserk, but barbarians are also skilled at things like finding their way in the wilderness, riding horses, traveling long distances on foot, tracking and foraging. Because "barbarian" is a word that would be used by a city-dweller to refer to a wilderness-dweller, naturally a "barbarian" would seem to the user to be very competent at surviving away from civilization, as well as being able to go berserk in combat.
On the other hand, a "berserker" is a word that would be used by a "barbarian" to refer to other barbarians, to whom the warrior would not seem any more adept at survival than the average person they meet (ie. other barbarians) but would seem to have a unique ability to berserk.
Since DnD seems to take place in the context of ersatz-medieval Europe, you could rationalize the name of the class in this way: Because the Barbarian can not only Rage but also has other "nature-y" skills, it's called a barbarian, not a berserker. "Berserker" classes tend to focus only on combat, not the survival aspect. Also, a barbarian may end his rage at will, and generally does not lose control over himself - while berserkers are often portrayed as having lost control, and often even failing to distinguish friend or foe.
However, fantasy terminology in general is sometimes nonsensical. Often synonymous words are treated as very different concepts - see Wizard, Sorcerer, Warlock, Witch, even Alchemist, which could be claimed to basically mean the same thing. See also how Warrior and Fighter are different classes, or the endless silliness in weapon names.
The High-elf Barbarians
If barbarian is a cultural term, then there is nothing wrong with a given species (which DnD for some reason incorrectly calls "races") being barbarians. Culture is not genetic. Even in reality, all barbarians and all non-barbarians were human, after all. Even if the species is mostly civilized, there may be small groups of individuals who exist in a savage state. Even in modern day there are savage humans.
Recall also the example of a Roman who decides to take on barbarian customs. There is also the related concept of otherwise civilized persons coming into extended contact with barbarians and "going native". So even if an individual is from a civilized species, AND happens to have been born and grown up in a civilized community, this individual may still be a barbarian or berserker without presenting any semantic contradictions.