Many websites claim that the longest possible chess game is 5,949 moves. Very few of them attempt to explain this number. I'm sure that it's wrong. In the first place, there is no limit to a game's length unless you compel the players to invoke the 50-move rule. A player may claim a draw if no pawn has been moved, and no piece captured, for 50 moves, but it's not mandatory. Rule 9.3 of the Laws of Chess provides that the draw occurs only if a correct claim of such is made by the player who is on move. For an example of this in practice, see Fressinet-Kosteniuk. The last capture of the game (of the last pawn) was on move 121, leaving a rook and bishop verus rook ending. Yet the game continued until move 237, when Fressinet resigned. (In Wikipedia, I explain why Fressinet did not try to claim a draw.)
OK, we'll take care of that by stipulating that each player must invoke the 50-move rule as soon as possible. We'll also stipulate that the game will be declared an immediate draw once there is insufficient material to checkmate (e.g. king and bishop versus king, king and knight versus king, or king versus king).
There is another wrinkle. Traditionally, one thinks of 50 moves as beginning with White's move number x and ending with Black's move x + 49 (for example, moves 1-50). Suppose, however, that White captures a piece on, say, move 1,000, and the next capture or pawn move occurs on Black's move 1,050. There is a strong argument that the interval from Black's 1,000th move through White's 1,050th move constitute 50 moves by each side, thus allowing the 50-move rule to be invoked. (Black has played moves 1000 to 1049, and White, moves 1001 to 1050.) I'm sure there's some simple way to deal with this, but since it doesn't come to mind, I'm going to ignore this problem. My final number may thus be a little too high - but it will be enough above 5,949 to show that that number is wrong.
OK, let's start counting. The players start out just bouncing their knights around. 1.Nc3 Nf6 2.Nh3 Na6. The 50th move by both players is 50.Ng8 Rxg8. The 100th moves is 100.Nb8 Rxb8. For the next 100 moves, Black keeps moving his knights, while White plays Ra1-b1-a1 and Rh1-g1-h1. White captures Black's knights on moves 150 and 200. 200 moves down, knights gone, we move on to pawn moves. There are sixteen pawns, each of which can move six times. 6 x 16 x 50 = 4,800. Then you take 50 moves each to capture the sixteen promoted pawns, the four rooks, the four bishops, and the two queens. 26 x 50 = 1,300. Make sure to save a rook or a queen for last, so the game can't be declared a draw because there's no mating material. After the pieces and pawns are gone, we're left with two kings, and the game is declared a draw. How long is the game? Adding the numbers together, we get 200 + 4,800 + 1,300 = 6,300 moves. As I say, this number may be a little too high because of the wrinkle explained in the prior paragraph. But even if we reduced it by a fiftieth (which I'm sure is too high), the number would be 6,174, so 5,949 is clearly too low. Another myth bites the dust.
UPDATE: Professor John Gossage points out a small flaw in my count. The pawns will not be able to get past each other unless you give them something to capture. So a few moves will have to be subtracted from my 6,300 number to account for that.
FURTHER ADDENDUM: Phony Benoni observes as ChessGames.com, "I think the pawn captures might have more of an effect on your longest move computation than you think. For all the pawns to promote, there must be at least eight pawn captures. For example, White might play axb, cxd, exf, gxh, while Black plays bxa, dxc, fxe, hxg.
This would reduce your count by 400 moves, dropping it from 6300 to 5900. The difference might be due to the usual counters not making your assumption to immediately declare a draw with K vs. K before playing an additional 50 moves."
Hmm, I'm afraid Phony Benoni makes an excellent point. I figured that each pawn move and each piece capture would add another 50 moves to the game's length. If many of the pawn moves have to be both pawn moves and piece captures, that radically reduces the number of moves. So it seems that I am full of it and that 5,949 or something close to it may indeed be correct. Dang. As Emily Litella would say, "Never mind."
YET ANOTHER ADDENDUM: Correspondence Grandmaster Jesper Norgaard says that the correct number is 5,898 - counting king versus king as an instant draw, which is a relatively recent addition to the FIDE Laws of Chess. So, taking the rosiest view of things, you could say that I was on the right track, apart from failing to recognize that eight pawn captures are necessary and that these shave 400 moves off the maximum.