Three thousand years before X&Y, there was a huge war in Kalos.
the king of Kalos, AZ, had a very beloved Floette (Which is in a special form, called the Eternal Flower form) which was killed in the war. In his grief, AZ built a device that he called the Ultimate Weapon, which he powered by taking the life of countless Pokémon. It revived Floette, but it wasn't the same. It was in a way... incomplete. But then, overwhelmed by loss and rage from both not having his true partner, and realizing the gravity of what he actually did. AZ used that same weapon to end the war by blasting both sides, including his own, killing hundreds of Pokémon and humans alike. The weapon released so much of the stolen life energy that it ended up making AZ immortal, and it cursed him to have to walk the Earth forever, eternally suffering without his partner, which left him after he destroyed everyone fighting in the war.
Fast-forward to the present. Enter Lysandre, the leader of Team Flare and a descendant of AZ’s royal line. Lysandre is obsessed with perfection. He believes the world is full of greed, destruction, and waste. He wants to stop humans before they destroy everything perfect and beautiful. He knows AZ’s old legend of the “Ultimate Weapon,” He sees the story as a blueprint to rebuild the Ultimate Weapon. He intends to use the weapon again to “reset” the world, destroying most of humanity so he can rebuild everything in a perfect way. He funds Team Flare, posing as a humanitarian and inventor, while secretly rebuilding the weapon beneath Geosenge Town. He’s not entirely evil. He genuinely thinks he’s saving the world. By the end of the game, he activates the weapon, realizes what he’s done, just as AZ does, and seems to die when it fires.
After the credits roll, AZ shows up.
He challenges you to a battle. Which is the first battle he’s had in 3000 years. Once you win, his Floette finally returns to him, symbolizing redemption.
Tell me if this is helpful!