Every telling of the story of King Arthur makes mention of the Round Table and the assemblage of peerless knights who sat around it. Most famous among these, both to us today and to many who have told the tales in the past, is Sir Lancelot du Lac, whose affair with Queen Guinevere would ultimately be the downfall of the entire Round Table. Many readers will therefore be surprised to learn that, in his earliest incarnations, Lancelot was not associated with King Arthur at all.
Lancelot first joins the Arthurian canon through the romances of Chretien de Troyes, who describes him as the most perfect knight who ever lived. Chretien first mentions Lancelot only in passing, as being among the knights of King Arthur's court, but later on, in Le Chevalier du Charette (The Knight of the Cart), he becomes a central character, and an illicit lover of Queen Guinevere. It is surprising that the folklore from which Chretien worked had Lancelot as the greatest of all knights, when in the French of the era his name was transparently an epithet, l'ancelot, "the servant."
It is in the Vulgate Cycle, however, that the life of Lancelot is first presented in the form used by Malory, whose version is of course the one made famous in more modern texts. And this version almost certainly draws from a prior folktale, attested in various parts of France. Details vary, but the folktale generally had a tournament at which the hero, at least sometimes named "Lancelin" (an easy name to transform into "l'ancelot" and thence into a proper name again as Lancelot), appears in a different disguise for each of three days, then must rescue a princess or queen from imprisonment. Lancelin is not associated with the Matter of Britain prior to the German epic Lanzelet, ca. 1200 (and, presumably, the oral sources which inspired it), but this introduces his childhood with the Lady of the Lake and his many quests.
Malory's Lancelot is a more complex figure than this fairytale hero, but those elements remain. Lancelot is the son of King Ban and Queen Elaine of Benwick, but raised by the Lady of the Lake, who sends him to join King Arthur's court. There he falls in love with Guinevere and goes on many quests, gaining great renown. Elaine of Corbenic uses magic to disguise herself as Guinevere and so court Lancelot; this union produces a son, Sir Galahad. The two of them, along with Sir Percival, later go on the quest for the Holy Grail (also an element of the Matter of Britain which is first added in the Vulgate cycle).
A version of the Lancelin story arises when Arthur's knights attend a tournament held by Bernard of Astolat. Lancelot declines to enter, but Bernard's daughter Elaine begs him to fight and to wear her token. Lancelot agrees, but since the love of his life is present also and he does not wish to offend her by wearing another lady's token, he fights in disguise. Injured in the fighting, Lancelot is nursed back to health by Elaine, and only then figures out that she is passionately in love with him. Not returning her feelings, he leaves, and Elaine subsequently dies of a broken heart. Her body is floated down the river to Camelot, clutching a letter for Lancelot which she had written on her deathbed; in it, she declares her love for Lancelot and begs him to pay for her funeral, which he does. (An Italian derivative of this tale, in which Elaine is replaced with the unnamed Lady of Scalotta who is under a curse and never meets Lancelot, is the source for Tennyson's Lady of Shalott, while Malory's version inspired one of the Idylls of the King.)
After Arthur's death, Guinevere attributes all of the breaking of the Round Table and the death of her husband to her affair with Lancelot and chooses to live a life of celibacy and penitence, entering a convent and refusing to see her former lover again.
This ending is Malory's, but it varies a great deal from how others end the story. The modern singer-songwriter Heather Dale, for instance, presents the attitudes of each of Arthur's knights in a song entitled "The Trial of Lancelot," which ends with the king weeping as he sentences both Lancelot and Guinevere to die for the treason of their affair. Chretien stops his story of the affair before anyone dies, while in Lanzelet Ulrich von Zartzikhoven tells us that he and his beloved princess Iblis die on the same day, shortly after he is invested as a landed lord; there is no indication that they have ever fallen out of love. Marion Zimmer Bradley stops her version prior to Lancelot's death, but has him a lover of both Arthur and Gwenhwyfar (Guinevere). TH White follows Malory, though as his focus is on Arthur and Merlin he does not dwell on events that follow after the King's death.
In reshaping the story of Lancelin to adhere to later ideals of courtly love, Chretien and those who came after him have given us a more nuanced hero, one whose flaws make him at once more appealing and yet also, in later versions of the tale, help bring ruin on his kingdom. In the development of Lancelot, we see the growth of folklore into literature, and the re-creation of Arthurian stories in the image of the high medieval court.