At the beginning of The Phantom Menace he is apprentice to Jedi Master Qui-Gon Jinn whom he accompanies to Naboo, the planet ruled by Queen Padme Amidala. On the death of his master at the hands of Darth Maul, Kenobi honoured his master's final wish to train Anakin Skywalker, a young boy who showed tremendous potential with the Force. The Jedi Council named him a Jedi Knight and reluctantly approved his request to take Anakin on as his Padawan (pupil).
By the time of Attack of the Clones, teenaged Anakin is already showing signs that Kenobi's training is not adequate to prevent him from being seduced by the Dark Side of the Force. Eventually, his pupil sides with the Supreme Chancellor Palpatine, a Dark Lord of the Sith, in his plot to become Emperor and to purge the Jedi Order. He was captured by Count Dooku, Qui-Gon Jinn's master, and sentenced to be executed, along with Anakin Skywalker and Padmé Amidala, in a Geonosian fashion. However, the executions were nullified by sudden Jedi reinforcements, led by Mace Windu. Episode III is expected to reveal that Kenobi and Skywalker fight resulting in the teacher wounding his student so badly that Skywalker needs extensive medical prothestics that became central to his new identity as Darth Vader
However, this clash does not halt the rise of the Galactic Empire and Kenobi is forced into hiding on the remote desert planet Tatooine where he goes by the name of Ben. He also hides Anakin's children: Luke on Tatooine with Owen Lars and Leia on Alderaan with Bail Organa. In the Return of the Jedi novelization, Obi-Wan refers to Owen Lars as his brother, but this is not expanded upon. Some thirty-two years after the events of TPM, he rescues Anakin's son, Luke Skywalker, from Tusken Raiders while in the wilderness of Tatooine looking for a droid named R2-D2 that has an important message for the old Jedi Knight, as chronicled in A New Hope. Kenobi eventually hears R2-D2's message from Princess Leia Organa asking for his assistance in delivering the schematics of the Death Star to Alderaan. While Kenobi is ready to help, he decides his best possible contribution would be to reestablish the Jedi order. To that end, he takes young Luke Skywalker under his wing and teaches him the ways of the Force with the intention of fully training him later on Alderaan.
Kenobi, Luke and the droids C-3PO and R2-D2 buy passage to Alderaan on smuggler Han Solo's ship, the Millennium Falcon. Before they can reach their destination, Alderaan is destroyed by the Death Star. The Millennium Falcon is captured by the Death Star, however Kenobi manages to deactivate the tractor beam to allow the ship to escape. Unfortunately for him, his return to the ship is cut off by Darth Vader who challenges Kenobi to combat. While occupying Vader and his stormtroopers, he creates the necessary distraction to allow Luke and the rest of the crew to reach the ship. Sacrificing his hope for escape, he allows Vader to strike him down, only to disappear instantly upon the final blow.
As it turns out, Kenobi does not vanish entirely. Rather, he becomes a spirit who advises Luke as a mentor that the Sith cannot touch. Most importantly, he tells Luke to use the Force to destroy the Death Star and to go to the Dagobah system for further training with Yoda.