Ash and his friends have stopped to enjoy another fine meal prepared by Brock. Golbat is the first to dig in. As it eats, Golbat's ears twitch and it flies away. Brock, Ash and Misty chase after it and end up at an archaeological dig. Upon reaching the site, Brock finds a fainted woman, Tierra, she quickly wakes up. The site appears to be destroyed, with machinery lying crumpled. Brock asks Tierra if she has a laptop computer to help fix the detector equipment, and she takes them to her site office. As Brock fixes Tierra's equipment, Tierra explains that she is looking for a buried temple described in an ancient tablet. According to the legend, thousands of years ago a queen along with her golden mask and staff had the power to control Pokémon. Tierra is now looking for the said buried temple and these two priceless artefacts. Eavesdropping on this, Team Rocket considers taking the mask and staff for themselves, to give half of the Pokémon to Giovanni and leaving the others for sale.
Meanwhile, Brock manages to fix Tierra's laptop, though the scanner was irreparable. Instead, Brock offers his Golbat's assistance, its Supersonic attack can help Tierra locate the exact placement of the temple. Ash claims that Brock is great with computers and references his actions at Dr. Anna's clinic. Misty notices that the located temple appears to be deep down. Tierra admits her digging equipment was destroyed after a column fell onto it. Brock promptly calls on his Geodude to Dig to the temple.
Meowth unveils their latest mechanical menace. They reach the site first, with the Dig-a-Tron drilling its way through a stone ceiling, the freefall causes the machine to suddenly stop. Team Rocket emerge from the machine uninjured and notice a statue with both the mask and staff. Jessie dons the mask and staff, declaring herself the "Queen of all Pokémon". She first tries her powers out on James's Victreebel, making it emerge from its Poké Ball and then attack James. Meowth first doubts Jessie's newfound power and then he finds himself doing a dance. When Ash and friends arrive at the temple, Tierra is shocked by Jessie's belligerence, she declares the mask and staff are priceless artefacts. Jessie takes control over Pikachu, commanding it to shock Ash with an electric attack. Pikachu then walks over to Jessie without hesitation. Team Rocket prepare to make their escape, but Meowth informs Jessie that the Dig-a-Tron does not have a reverse feature. In the delay, Brock calls upon Geodude, Onix and Golbat to get Pikachu back. Jessie takes control of all three of them, however Golbat manages to break loose of the spell and starts to attack Jessie with a Supersonic attack, which repels the staff's power. Jessie commands Geodude to attack Golbat and Onix to carry the Dig-a-Tron back to the surface. Onix smashes through a temple wall, causing the ceiling to collapse. The group and Geodude emerge safely from the rubble, and Brock begins to listen out for Golbat. Brock successfully locates and reaches Golbat just as more of the temple is collapsing.
Up on the surface Team Rocket are waiting to ambush Ash and his friends. Jessie and Pikachu, in preparation, walk over to the exit tunnel and cross a strange marking on the ground, the spell breaks and Pikachu uses its Thunderbolt attack on Jessie. Jessie and Pikachu once again cross this same border, and the staff's control over Pikachu returns to full effect. This same scene unfolds again, this time Ash and friends have made it to the surface. Tierra explains that the power of the mask and staff only works within the home village of the queen. Jessie is conflicted with this sudden predicament. Upon hearing this Team Rocket jump back into the Dig-a-tron, and the mecha transforms into a rocket. As the trio prepare to make their escape, Ash sends out Noctowl to chase the trio alongside Golbat. However, the Dig-a-tron is too fast for both Flying-type Pokémon. Inside the machine, Jessie removes the queen's mask, noting it may be worth its weight in gold. Brock offers some encouraging words to Golbat and upon hearing this, Golbat begins to evolves into a Crobat. Now with four wings instead of two, Crobat soon catches up with Team Rocket and uses a Wing Attack to slice the Dig-a-tron into pieces. Team Rocket falls onto the ground below. Jessie attempts to grab the gold mask and staff, but she is blocked by the newly evolved Crobat. It is not long until Ash and friends catch up and Team Rocket get a zap of Thunderbolt to send them blasting off.
The group meet back at Tierra's site office. Tierra admits that the temple was destroyed, but she happily reports that the staff and mask will offer her plenty of insight into the legend. Brock declares his love and desire to stay with Tierra, in response Misty pulls Brock away by the ear. The group leave behind Tierra, who is excited about the new discovery, and carry on their journey.