The Holy Grail was first incorporated into the Arthurian legends by Chrétien de Troyes, more famous for his romantic stories of the other knights, as one of those romances: Perceval, the Story of the Grail. Chrétien used a lot of Christian imagery compared to the earlier Arthurian stories, probably because instead of being somewhat pagan like the Bretons he was Christian. It was also one of his Chivalric Romances, and many versions feature a romance either waiting for Perceval or between his sister and a knight (often Galahad or Bors), or an implied one tying knights to the purity of Christianity.
The background to the story uses the Biblical story of Jesus' ascension, saying that Jesus handed off the Holy Grail to his great-uncle Joseph of Arimathea at the Last Supper and this Joseph collected his blood and sweat whilst tending Jesus on the Cross. Joseph was locked in a stone tomb to die for his association with Jesus, but the grail gave him sustenance every day. Then it adds that he later travelled to Britain with several followers and lived at Glastonbury, giving the grail to his daughter Anna when she married Bran. Bran became the first of the Grail Kings of Corbenic. After several centuries, the location of the Grail Castle had become forgotten in the kingdoms, but prophecy revealed during Arthur's reign suggested that the most noble of men would be able to see it. The most noble of men who also completed a quest.
This guy is apparently Galahad, who is the son of Lancelot but is pure, but in Chrétien's original was Perceval, who is pretty perfect. A lot of versions now include them both — the summary below lets you imagine it with either knight. Galahad is an illegitimate son of Elaine and Lancelot, and who is prophesised by Merlin to surpass his father in valour and so ultimately be able to see the Holy Grail.
Additional background is that the story is based entirely around the Celtic trope of the Dolorous Stroke, which is a mystical wound often of divine vengeance stricken upon someone immoral so that they (and their land and issue, etc.) must be redeemed. In the story this is the Fisher King, so called because all he can do is fish, but commonly named some form of Pellam. This is not to be confused with Pelles, who is the son of Pellam, maternal grandfather of Galahad, and also maimed but for something else.
Most versions of the story begin around the introduction of Galahad as a knight, and include that when the knights are gathered at the Round Table is when they first see visions of the Holy Grail. Many include Sir Perceval's sister, the most beautiful woman in all the land and pure of heart. She is often the first to see the grail and helps the knights on their quest, giving Galahad or Perceval a belt woven from her golden hair and stitched with red and silver depicting the grail. Only people who are completely good can see the grail, and most of the knights are chivalrous but have sinned and so see it through clouds.
Either upon it being revealed to them, or having been agreed upon by prophecy, the knights set out for a year and a day to find the grail. Either they start out together but progressively get separated, or start out separate but some are brought together, implied to be mystically. After the twelve months, only Gawain and Lancelot return, unsuccessful in their quest, and then some time later Sir Bors and/or Perceval returns, also. Some versions tell the story as it happens, whereas some use Bors (or Perceval) retelling it after returning. What happened was:
In some versions, Bors has joined Perceval immediately prior to the start of this part. Perceval almost quits the quest but meets a hermit and reaffirms his faith and his vow to find the grail, and is met by Galahad at this point. They then continue on, having a much more successful time than before. If they don't already have Bors, they rescue him from a situation and he joins them, too (if he doesn't, he's been removed from the story), and sometimes Perceval's sister also appears to help them out. The heroes come together, basically, and sometimes Galahad reveals that he's been seeing the grail, sometimes Perceval sees it in a chapel.
They then come by Corbenic, by chance, by Galahad or by Perceval's sister, which is the Grail Castle. In some versions, Galahad is immediately sacrificed to purify his ancestral land (and Perceval), with that being the end or with Perceval and Bors continuing; otherwise, the knights have a catch-up with Galahad's family (who are the same even if Galahad isn't there) and are given the grail and told to return it to Sarras in the Middle East because it is too powerful for any man. If Galahad is around, he either ascends in Sarras or on the way home, because he's kind of like Jesus. Perceval either stays in Sarras as a hermit preacher or returns and tells the story himself.
- Adaptational Jerkass: While Perceval was the original hero, he is often made less noble to martyr Galahad.
- Ascended Extra: In whatever version, the main characters are usually Galahad, Perceval, Bors, and Perceval's unnamed sister.
- Beauty = Goodness: Perceval's sister.
- Canon Sue: Galahad, by many reasonable measures.
- Demoted to Extra: Arthur, though this is typical for the later stories, as they focus on other knights and morals.
- Depending on the Writer: Perceval is usually present in the story, but his actual role differs a lot.
- Fisher King: The Trope Namer, Pellam, who received a wound that matched his sin (on the groin), as he is hurt so is his kingdom. He is injured enough to do nothing but fish, though it's not lack of attention to his kingdom that sends it to ruin, it's the symbiotic connection between king and ruler and the magic used to wound him.
- Hair of Gold, Heart of Gold: Perceval's sister.
- It May Help You on Your Quest: The sword belt given by Perceval's sister.
- Long-Lost Relative: Pellem as Galahad's grandfather — as such so that he can be healed/redeemed by a relative. This is likely why the character of Galahad was invented, because the preexisting knights already had backstories and couldn't be Biblical, too.
- Messianic Archetype: Galahad.
- Pop-Cultural Osmosis: This myth is the first mention of a Holy Grail even existing, and now it's a stable religious image. Similarly, the more popular versions of this story are all comedies either by Monty Python or members of Monty Python.
- Pop Culture Symbology: Doesn't feature it, but is used as it.
- Red Is Heroic: Perceval is the Red Knight.