In the legendary past, before the creation of Poké Balls, an Aura-guiding Pokémon called Lucario senses two rival armies about to clash near Cameran Palace in the Kanto region. He telepathically informs his master, Sir Aaron, through a nearby crystal just before being attacked by three Houndoom. During the battle, Lucario is temporarily blinded, but is still able to use his Aura Sphere to defeat the Houndoom – sensing their movements with his Aura abilities. The Queen of Cameran, Lady Rin, decides it is right to die with her people, so Aaron leaves on his Pidgeot to meet up with Lucario, but is attacked by a rival group of Skarmory on the way. Aaron tells Lucario that he is leaving and will not be coming back, and when Lucario tries to follow him, he is automatically sealed in Aaron’s staff. The Tree of Beginning then shines a bright light covering the land; stopping the war, and the queen realizes that Aaron must have sacrificed himself by using his own Aura to transform the armies’ hatred into mutual understanding. Since then, he was hailed as a hero, and only his staff remained for his legacy.
Around one thousand years later, Ash Ketchum, his partner Pokémon Pikachu, and their travelling companions Brock, May and Max arrive at Cameran Palace to celebrate the life of Sir Aaron. Ash competes in a Pokémon battle tournament, and wins against Kidd Summers and her Weavile. That night, there is a royal ball, and as the winner of the tournament, Ash is rewarded with the title of “Hero of the Year” and the privilege to hold Aaron’s staff. Team Rocket join the dance too, but Meowth runs off to follow Kidd. She reveals herself as an agent explorer, and is performing research on Mew, who is known to appear at the palace. Ash and May’s Pokémon run off into the attic of the palace to play. However, Kidd’s two Weavile attack when Mew joins in. As Max watches through a crack in the door, Mew teleports Pikachu and Meowth onto the roof of the castle, before transforming into a Pidgeot and flying away with them. In the ballroom, Ash watches the fireworks display. However, Ash begins to hear a voice coming from the crystal on his staff. The crystal begins to glow, and Lucario is freed from the staff due to Ash’s Aura having a close resemblance to Aaron’s. Lucario is confused about what’s happened since he was sealed, and goes to search for answers.
Max informs the rest of the group on what happened, while Team Rocket overhear him. Lady Ilene, the current queen, says Mew has a tradition of showing up at the palace and taking toys to its home at the Tree of Beginning. Ash and his friends begin to work with Kidd (who’s also revealed to be famous) and the group head off to the Tree of Beginning with Lucario’s help, and Team Rocket following by hiding in Kidd’s trunk. On their journey, they find a Time Flower (which allows the finder to look at images of the past) and meet a Bonsly which hitches a ride with the group. That night, Ash recalls how much he and Pikachu have been through, such as on their first day together when a flock of Spearow attacked him, and Pikachu leaped to save Ash. Lucario scoffs at the story, saying humans can never be trusted after his apparent betrayal by Sir Aaron in the past. Ash gets angry at this and tackles Lucario, resulting in a brawl. Max tries to cheer the Pokémon up with some chocolate, which Lucario is unfamiliar with.
The next morning, Lucario encounters the same area where he was sealed in the staff. A Time Flower projects the moment, showing Sir Aaron trapping Lucario and flying away, making everyone believe Lucario in saying that he was betrayed. Ash apologizes to Lucario for his previous behavior. Lucario, forgiving him, asks Ash to promise that he will not desert Pikachu. At that moment, a Regirock attacks, and everyone runs into the Tree of Beginning. Ash and Lucario split up, with May, Max, Brock, and Kidd heading a different direction. Ash ends up getting attacked by a Regice that blocks their path, so he and Lucario decide to backtrack. Meanwhile, everyone else is attacked by a Registeel before red blob “antibodies” produced by the Tree begin devouring May, Max, Brock, and Team Rocket as if they are a disease.
Ash finally reunites with Pikachu and meets up with Meowth and Kidd, who are the only members of the group left. Soon, Ash and Kidd are attacked and eaten by the antibodies as well, while Registeel stops Lucario from saving them. All of the Pokémon cry over their Trainers’ apparent deaths. However, Mew decides to talk with the Tree, using its powers to inform the Tree that humans aren’t trying to harm it. Eventually, everyone is brought back; however Mew becomes badly ill afterwards. Finding out that the Tree is dying due to its immune system going into shock, Ash, Kidd, Mew, and Lucario run into the heart of the Tree. They find a crystal with Sir Aaron’s body inside and a Time Flower showing that the legend was true – Aaron actually used his Aura to end the ancient war, at the cost of his life.
Lucario realizes that he can also restore the Tree by using his Aura powers. Due to his similar Aura, Ash uses Aaron’s gloves to help complete the procedure, despite both knowing they will die as a result. As the Aura Sphere grows larger and more powerful, Lucario knocks Ash back and demands to finish the rest. The Tree and Mew are restored back to health, but Lucario only has little time left. Another Time Flower is found, showing Sir Aaron saying goodbye to Lucario as he dies. Lucario begins crying at seeing his master’s final image, apologizing for failing his master, realizing that Aaron sealed him away to prevent him from making the same sacrifice. Ash holds Lucario’s paws and says that he proved to be as good a Guardian of Aura as Sir Aaron. Lucario finally passes away, but not before thanking Ash, knowing that Sir Aaron is waiting for him Kidd decides the Tree’s mystery should be kept secret to prevent tourism.
Ash and Kidd meet with May, Brock, and Max outside, who realize Lucario is not with them. After explaining the situation, Brock mentions it is hard to believe that Lucario is gone, but Ash says “No, Lucario isn’t gone… his Aura is with me.”
In the credits sequence, it is shown that Ash and friends return to the palace and are rewarded by Lady Ilene, while the portrait of Sir Aaron at the castle is updated to include Lucario. In the afterlife, Lucario and Sir Aaron share a bar of chocolate, while Kidd leaves the group and journeys to Forina in Hoenn, and Ash and his friends continue on their journey in the Kanto region.