The Legend of X, Y, and Z! (Japanese: XYZの伝説！The Legend of XYZ!) is the fifth special episode of the XY series. It first aired in Japan on November 3, 2016, in Canada on January 21, 2017, and in the United States on January 28, 2017.
Professor Sycamore and Alexa explore some ruins, where they discover a stone statue of a woman named Aila, and a legend emerges. A collection of Kalos records reveals that Aila’s true love, Jan, attempted to vanquish the Destruction Pokémon Yveltal. When he failed, the land was drained of all life as Yveltal became a cocoon and turned Aila to stone.
Jan continued his quest, seeking out the Life Pokémon Xerneas to replenish the barren land—although it couldn’t save Aila. When Kalos seemed hopelessly out of balance, the Order Pokémon Zygarde appeared to restore it, and Jan remained at Aila’s side as the cycle of life and destruction continued.
A long time ago, on a clifftop, a woman called Aila tries to convince Jan not to leave but Jan promises her that he will defeat the Legendary PokémonYveltal before riding out on his Gogoat. In the present day, Professor Sycamore is walking towards some ruins and meets Alexa and Helioptile. He is here to investigate the ruins as they can confirm the truth of a Kalos legend. Alexa takes him along a passage to where the Maiden Statue is. Alexa came to report on the lives of people and Pokémon who were living at the time. Arriving at the location, Professor Sycamore spots the stone statue of Aila and brings up the historical records. Professor Sycamore notes that the records show perfectly matches the statue. Professor Sycamore believes the one responsible for turning her to stone was the Destruction Pokémon Yveltal
Professor Sycamore tells the story of Jan and Aila, the daughter of the village chief who fell in love with each other. The village Oracle Olympica had made a prediction that Yveltal would descend upon the land and absorb the life force of all living things. Once Aila's father heard the prophecy, he ordered Jan to defeat Yveltal in order to protect the city with his daughter's hand in marriage as his reward for success. Aila tried to stop Jan, knowing that Yveltal is extremely dangerous. As Jan set off, a screeching noise is heard and he sees that Yveltal has appeared behind Aila. Jan fires several arrows from his bow at Yveltal before ordering Talonflame to attack, only to be turned into stone. Jan continues to attack Yveltal, but another Oblivion Wing turns Aila to stone as Jan is thrown off the cliff.
Professor Sycamore says that Yveltal turned itself into a cocoon and absorbed all of the life forces around it. This left the land barren and allowed Yveltal to enter a long slumber. The theory is that Yveltal wakes every 1,000 years but isn't certain whether is awake and active. In the past, Jan is approached by Olympica and her two Meowstic who tells him that the precious few that survived have left. Olympica informs him that there is once chance of rescuing Aila if he finds Xerneas and explains that Xerneas is Yveltal's equal. Olympica instructs him to find a forest that glimmers like a rainbow as wherever Xerneas is, that forest flourishes. Professor Sycamore explains that Jan visited many lush forests but because Xerneas is constantly on the move.
In the past, Jan arrives in a forest and purple fog surrounds them. He finds an injured Scatterbug lying on the forest ground as an old man approaches him. The old man mentions that the people of a man called Veofum came and dragged Xerneas away. Veofum was the ruler of a small kingdom with the goal to manipulate Xerneas' power. Jan rides Gogoat and arrives at the kingdom. Veofum isn't happy that nothing is flourishing and orders his Advisor to set the tree on fire. Jan rides into the kingdom and shouts at them to stop. Soldiers stop him as he begs them to put out the fire as Jan it will make Xerneas suffer. Lightning starts to strike and several ZygardeCells appear and become collected as Zygarde 50% Forme appears. Everyone starts to run away as Zygarde destroys the kingdom with Land's Wrath.
As Zygarde returns to its Cells, Jan watches as the tree becomes Xerneas and realizing what has happened, begs Xerneas to use its power to help him. Xerneas ignores him and walks away as Jan begs for help. Jan returns to Aila's statue and comes to the decision to protect the land and moves the statue to another location. Professor Sycamore explains that Jan recorded everything and Alexa realizes that it was passed down to them. In the past, a light appeared before Jan who spots Xerneas. Xerneas emits its aura and the barren land returns to its former glory. Professor Sycamore believes that both Xerneas and Yveltal are incarnations of nature that take care of the land but when the natural order is undone, Zygarde appears to balance it. Alexa asks what became of Jan but the legend says nothing about his fate.
In the past, a now elderly Jan is sleeping when a young girl approaches. Jan tells her that he was having a conversation with the statue that thanks to Xerneas, the season has bloomed once more and mentions that a long time ago, he met the three legendary Pokémon which amazes her and that the forest remains lush thanks to all three of them as the girl invites him back to her house so she can hear more about his stories but Jan doesn't want to leave, saying he wants to stay because of Aila and will always remain here and returns to his nap before thanking the girl for the chat.