Using loaded expressions to start (or try to end) a disagreement
The problem with using a loaded expression like "the GM is always right" is that it is often too broad in terms of how the social dynamics of a given group of people interact.
The point of having a referee, GM, Judge, DM, or other rules arbiter1 is to make decisions during play so that play may continue fairly; this need predates the publication of D&D or any other RPG. A referee or a judge was a feature of the Braunstein games that predated D&D as well as some miniatures war games that featured Napoleonic battles, micro-armor, medieval and ancient armies and various other forms of battles on tabletops.
If a situation arose where the rules were either ambiguous or didn't fit a given situation, or were simply lacking, then in order for the game to continue the referee had to make a ruling. All of the players had to accept the referee's ruling as final so that convention leads to the referee's ruling is right. Without that agreement at the game table, play could grind to a halt over a rules dispute. (See the second half of this answer for an example).
The DM as final authority2 is as old as the game of D&D
An early codification of the DM (GM) being the final authority was in the AD&D Dungeon Master's Guide (TSR, in 1979). The terms Dungeon Master and referee are used interchangeably throughout that book; in the original game (published in 1974) referee was the term for whomever was running a particular game/campaign. See my point above about why the referee needs to be accepted as "being right" in order for play to continue fairly.
Extracts from the AD&D DMG:
PREFACE (DMG, page 7)
What follows herein is strictly for the eyes of you, the campaign referee. As the creator and ultimate authority in your respective game, this work is written as one Dungeon Master equal to another. Pronouncements there may be, but they are not from "on high" as respects your game.
From the Introduction (DMG, page 9)
Know the game systems, and you will know how and when to take upon yourself the ultimate power. To become the final arbiter, rather than the interpreter of the rules, can be a difficult and demanding task, and it cannot be undertaken lightly, for your players expect to play this game, not one made up on the spot. By the same token, they are playing the game the way you, their DM, imagines and creates it.
It is no stretch to see the link back to the at-the-table-agreement to abide by the rules of the referee in games that predate D&D and role playing games.
About DM rights (DMG, page 110)
ROLLING THE DICE AND CONTROL OF THE GAME
In many situations it is correct and fun to have the players dice such things as melee hits or saving throws. However, it is your right to control the dice at any time and to roll dice for the players. You might wish to do this to keep them from knowing some specific fact. You also might wish to give them an edge in finding a particular clue, e.g. a secret door that leads to a complex of monsters and treasures that will be especially entertaining. You do have every right to overrule the dice at any time if there is a particular course of events that you would like to have occur. In making such a decision you should never seriously harm the party or a non-player character with your actions.
The dice have no authority over the DM/GM. (They are a tool to help keep play moving).
In the Moldvay Basic Set (TSR, 1980) on page B60, there's a clear assertion of DM authority:
The DM is the Boss. The DM decides how these rules will be used in the game. A good DM talks about problem areas with the players and considers reasonable requests by them. The players should realize, however, that the final decision is the DM's: not theirs, and not this booklet's! If a disagreement holds up play, the DM may make a temporary decision and talk it over with the players when the adventure is over.
That last sentence is still very good advice almost 40 years later.
Game Philosophy from the creators
An earlier reference to absolute GM / DM authority is found in a letter written by Gary Gygax to the publisher of the newsletter Alarums and Excursions (Lee Gold) around 1976.
Dave and I disagree on how to handle any number of things, and both of our campaigns differ from the "rules" found in D&D. If the time ever comes when all aspects of fantasy are covered and the vast majority of its players agree on how the game should be played, D&D will have become staid and boring indeed. {snip} D&D is supposed to offer a challenge to the imagination and to do so in many ways. {snip} Frankly, the reason I enjoy playing in Dave Arneson's campaign is that I do not know his treatments of monsters and suchlike, so I must keep thinking and reasoning in order to "survive". {snip} D&D enthusiasts are far too individualistic and imaginative a bunch to be in agreement, and I certainly refuse to play god for them - except as a referee in my own campaign where they jolly well better toe the mark
This point was also made in an article on variations in player alignment within a party in Dragon Magazine #9 (September 1977).
All that takes place in the campaign is subject to intervention by the DM, and players must always understand that fact. (Gary Gygax, Dragon Magazine #9, p. 6)
Proto-RPG influences (1970-1973)
Before Greyhawk, there was Blackmoor. Before the Dungeon Master, there was the Judge. Before d20s, there were d6s, and a lot of them. (Kobold Press Interview with Dave Arneson)
I don't have the text of the whole interview, however, some excerpts are still at the link.
(KQ) Rules… strict or loose?
Arneson: I like loose so you can change things that are not working. I dislike “Rules Lawyers” intensely. I regard them as the enemy.
Note: rules lawyers are not the only kind of players who may disagree with a DM, but are (in my experience) the kind of players whose objection will most often drag a game to a halt.
(KQ) What role does improvisation play in game design in general?
Arneson: Lots. The rules cannot cover every possibility. And frankly speaking, they shouldn’t. The referee needs the freedom to keep making the game fun.
While Arneson's tone is quite different from "the GM is always right" in this reply, his position was that the DM is the one who shapes the game so that players can rise to various challenges, and that rules should not be an obstacle to the DM's creative abilities.
(KQ) What is your DMing style?
Arneson: The players are there to keep the referee amused. If they don’t, he will find a way to make it entertaining. But seriously it should be fun for everyone. But still, I do like to keep the game moving along. {Note: I am pretty sure that this was said in a playful tone, but do not have the full text of the interview}
This last point links to the point I refer to at the beginning of this answer: the DM / GM / Referee / Judge is the one who makes a ruling or a decision that keeps the game moving along. This is in everyone's interest at the table.
1 The terms DM, judge & referee are all synonymous in D&D; largely a matter of choice. (~ Tim Kask, Editor, Dragon Magazine #9, page 6).
2 The AD&D 1e PHB (p. 8) tells the players explicitly that the referee is the final arbiter of all affairs in his or her campaign