Ash and Goh arrive in Littleroot Town in the Hoenn region via train, their current research mission being to observe the yearly Beautifly migration. A Wurmple crawls in front of them, and Goh decides to catch it. When Raboot refuses to help, Goh's Poké Ball throw loses all effort and fails to hit the Wurmple, causing it to get away. Ash asks why Goh would want another Wurmple, given that he's already caught some before, but Goh replies that he wanted to catch another one to try to evolve it.
At the local Pokémon Center, Ash and Goh ask Nurse Joy about the Beautifly migration. While she can't tell them where exactly it will occur, due to the spot changing each year, she knows that it's most likely to happen when the wind blows from the north, as the Beautifly are heading south. The two head to the coast, but as the winds are blowing from the southeast, Goh figures the migration won't start today. Reading Beautifly's Pokédex entry from his Rotom Phone, he figures they should search for their standby location in a place where their favorite food, sweet flower pollen, is available. While searching, they come across a Zigzagoon laying on the ground. However, while Ash goes to check on it, Raboot, a former street Pokémon, sees what's going on, and stops another Zigzagoon from stealing food from Ash's backpack. Their plan foiled, the two Tiny Raccoon Pokémon run away back to their leader, a Lombre, leaving Ash and Goh confused of what just happened.
After failing to find a single Beautifly, Ash and Goh go to a hotel sleep. The Wurmple from before briefly reappears behind the window before running away again. However, thinking about wanting a Silcoon makes Goh realize that they should be looking for Silcoon instead, as they will evolve when the winds are blowing in the right direction. He searches for any possible locations for them on his phone map, and locates a nearby grove where they could be. While the two go to sleep in preparation for exploring the grove the next day, Raboot secretly sneaks out, returning in the morning just as Goh wakes up, ignoring his question about where it has been.
After breakfast next morning, Ash and Goh successfully find a horde of Silcoon in the grove. With a strong tailwind blowing all day, the migration seems likely to happen the next day. As they return to town to wait, Goh watches Ash and Pikachu interacting and muses how close they are. They pass by an apple merchant, and Raboot asks Goh to buy some apples for it. Goh complies, but as Raboot refuses to share a single one with him, Goh starts demanding why it has acted like this ever since it evolved. The apple merchant laughs and remarks that Raboot reminds her of her son, saying that it's going through a rebellious phase, which will go over in time. That night, Raboot sneaks out again and Goh tries to follow, but ends up losing sight of his partner.
The next day, Ash and Goh rush back to the grove. With the north winds growing stronger by the minute, the migration is due to start any moment now. And once they arrive at the grove, the Silcoon indeed all evolve into Beautifly and ride away on the wind. While mesmerized by the sight, Ash asks Goh if he wants to catch any of them, but he chooses not to, just enjoying the beautiful sight.
With their research task completed, they're ready to leave the next day. However, before that, Goh asks Ash help him to figure out where Raboot is going every night. As this happens again the next night, Ash, Goh, and Pikachu follow it. They lose the sight of it, but follow a strange sound to an abandoned building, where Raboot is giving breakdancing lessons to the Lombre and pair of Zigzagoon from before, while also sharing the apples Goh bought to it with them. Seeing Raboot actually smiling with them makes Goh think, but his thoughts are interrupted as a trio of Loudred appears on the scene, engaging in a dance battle with Raboot. Understanding that Raboot is trying to help Lombre and the Zigzagoon to learn to dance in order to defend their territory, he enters the scene, much to Raboot's surprise, clapping for it to keep it focused on the rhythm despite Loudred's sounds. Ash and Pikachu also step in to help, using empty barrels as drums to provide music. The dance and the music also catch the attention of various other wild Pokémon nearby, and they join in the dancing too. The dance battle ends in Raboot's victory, and all the Pokémon congratulate it. Seeing Raboot being so happy with the other Pokémon, Goh makes a decision.
The next morning, while Ash is at the train station, Goh is at the abandoned building, watching Raboot sleeping with the other Pokémon. He bids his partner farewell and joins Ash at the train station, revealing why that he left Raboot behind. He thinks that Raboot's recent behavior wasn't a rebellious phase, but solely his own fault, and believes it'll be happier without him. As he and Ash board the train, Ash says that he won't stop Goh if he's made up his mind, but asks if he at least told Raboot. This question causes Goh to understand what he's done, but the train doors close and the train starts moving before he can exit. He rushes along the train, desperate to get closer to Raboot, but falls over. As Goh cries over his partner, Raboot suddenly enters the van through a door, having boarded the train without Goh knowing. Raboot offers an apple to its teary-eyed Trainer, who takes a bite, before giving the apple back to it. Goh notices a a smile on Raboot's face and hugs it, much to Raboot's embarrassment. He celebrates their reunion by taking a selfie of himself and his blushing partner.