Alignment is described in Moldvay as a "way of life" or "belief". The d20 SRD describes it as "general moral and personal attitudes", which is very similar to 5e Basic. In the original game, alignment isn't described at all, so one might look to this more recent definitions to understand it. But OD&D tells a different story.
Although OD&D doesn't define alignment, it has a feature that is not repeated in other editions: a table with all creatures divided by alignment. Not even the monster's manuals, as far as I remember, index creatures by alignment. The table is on page 9 of Men & Magic:
Individual monster descriptions didn't necessarily mention alignments, nor did the monster reference table. On the contrary, as the table above shows, different alignments were separated in factions or "teams".
Although the table above doesn't appear in later editions, a similar one did appear in Chainmail. Since Chainmail is a wargame, the purpose seems to be to allow different armies to use some special units and not others.
This means that, in OD&D, choosing alignment was apparently akin to choosing a side in an ongoing struggle between the opposing forces of Law and Chaos. "Taking a stance", as OD&D describes.
There are other bits in OD&D that points to "alignment as faction" concept. For example, the fact that there are alignment languages (people in the same team must have a way to communicate) and that chaotic creatures will apparently recognize lawful language and attack its speakers. If "chaotic" was an evil, selfish or reckless behavior, you would expect chaotic creatures to attack anyone (specially other chaotic creatures), but they seem to be taking sides.
This would quickly change, with subsequent editions as early as Holmes describing alignment as behaviors and adding new options such as Good and Evil in addition to Law and Chaos - while on the earlier editions, Chaos was synonymous to Evil and Law to Good, as you can clearly see in Chainmail (3rd edition, page 39):
It is impossible to draw a distanct line between "good" and "evil" fantastic
figures. Three categories are listed below as a general guide for the wargamer
designing orders of battle involving fantastic creatures:
LAW NEUTRAL CHAOS [...]
After OD&D, alignment is described in every monster's description in all editions, making it look more like an individual behavior than a collective trait. There is no explicit reason for this change, nor do I know how voluntary it is. I would guess one of the main causes is a natural change of perspective from wargames focusing on large armies to roleplaying games focusing on individual characters and the interactions between them.
This change, although early, would never be complete. Most editions of D&D would use alignment both as personal morals/attitudes and as cosmic factions/teams. Take 5e basic, for example, that says:
For many thinking creatures, alignment is a moral choice. Humans, dwarves, elves, and other humanoid races can choose whether to follow the paths of good or evil, law or chaos. According to myth, the good-aligned gods who created these races gave them free will to choose their moral paths, knowing that good without free will is slavery.
The evil deities who created other races, though, made those races to serve them. Those races have strong inborn tendencies that match the nature of their gods. Most orcs share the violent, savage nature of the orc god, Gruumsh, and are thus inclined toward evil. Even if an orc chooses a good alignment, it struggles against its innate tendencies for its entire life. (Even half-orcs feel the lingering pull of the orc god’s influence.)
Alignment is an essential part of the nature of celestials and fiends. A devil does not choose to be lawful evil, and it doesn’t tend toward lawful evil, but rather it is lawful evil in its essence. If it somehow ceased to be lawful evil, it would cease to be a devil.
The confusion between the concepts of "morals" and "teams" is the source of many arguments on alignment. For example, should a good-aligned creature slay an evil-aligned one in cold blood, just because it is evil? If alignment is a moral choice, probably not, but if alignment is a side in a cosmic war, it depends on what is best for your team.
Another example are "lawful" characters. Are they honorable, or defenders of Law? The two will often lead to different actions. Moorcock readers will remember the scene where Elric and his companions face the Sad Giant to get his Chaos Shield in order to help the forces of Law to defeat the Lords of Chaos. Expecting to fight a fearful monster, they find instead a lonely, broken creature that offers to give away the shield without a fight, asking only to be spared. Elric decides to let him go. But his friend Moonglum (a loyal and benevolent character) immediately goes after the Giant. This is how the (awesome) comic book version by P. Craig Russell portrays what happens next:
In my opinion, alignment-as-morals doesn't work too well, because it is too restrictive to express personal attitudes (although there are some good ideas online on how to use it this way). Alignment-as-factions, on the other hand, can work well sometimes, if the literary foundations of the idea are known, and depending on the setting. But using both at the same time is a quick path to argument and confusion, which might be the reason why the latest editions have little mechanic effects related to alignment.
One problem that using alignment both ways causes is that it might make you think that people with the same "morals" are on the same "team", which is strange in real life (where you would expect even good, honest people to bump heads and maybe even go to war from time to time), and only makes sense in very black-and-white settings, where Good and Evil are easier to define and recognize. Another problem is that it doesn't make much sense if we think about D&D's literary inspirations, as David Paul explains in this great post:
The Law vs. Chaos concept first shows up in Poul Anderson's fantasy (Three Hearts and Three Lions and The Broken Sword.) In Anderson, Law is pretty much synonymous with Good and Chaos with Evil. Even the more sympathetic Chaos creatures, like elves, are pretty much always bad news for humanity.
Michael Moorcock adopted the labels of "Law" and "Chaos," but radically changed them by introducing the notion of the Cosmic Balance. In this version, the extremes of Law and Chaos are both equally bad, or at least inimical to life as we know it. Only when the two are in balance is life possible. The metaphysical forces in charge of keeping the Balance are thus, broadly speaking, good; but they can be extremely ruthless and manipulative in pursuit of their duties.
The earliest version of D&D used Lawful, Neutral, and Chaotic as the only alignments, and leaned more towards Anderson than Moorcock in how it interpreted them: Lawful characters were usually heroic, Chaotic characters were usually villainous, and Neutral characters were indifferent rather than serving any kind of Cosmic Balance. [...]
AD&D added the Good vs. Evil axis to Law vs. Chaos, creating the nine-point alignment system we all know and... know. The thing is, nine-point alignment has never made a lot of sense in terms of D&D's literary inspiration -- from the Andersonian perspective it's redundant, and from the Moorcockian perspective it tries to add objective morality to a cosmology that was deliberately designed to be morally ambiguous. Making things even more confusing, True Neutral became the alignment of both the morally indifferent and servants of the Balance -- a Balance which now included the totally unprecedented and rather nonsensical idea of parity between Good and Evil. I honestly have no clue what led anyone to think this was a good idea. [...]
I'll discuss a few of my own solutions in the coming posts. Feel free to tell me yours!