Hundreds of years prior to the movie's events, Yveltal almost destroyed all life in Allearth Forest. Xerneas saved Dace and many other Pokémon from the destruction, and later reversed all the damage Yveltal did.
Diancie, unable to create diamonds without them disappearing after a few seconds, sought after Xerneas in hopes that it would give her the power to create diamonds that would not disappear, as if the Diamond Domain's Heart Diamond disappeared, the Domain could collapse, and Diancie was not able to create a new one. When Diancie met Xerneas, it revealed it was aware of Diancie's reason for seeking it, and told her that the power was within her. It then granted Diancie what she was looking for: its Fairy Aura.
Later, after Yveltal awakened again and had petrified large areas of the forest, Team Rocket, Marilyn Flame, Ninja Riot, TheSteels, the Carbink servants (save for Dace), and Pikachu (who tried to battle Yveltal) with Oblivion Wing, Eventually, Xerneas protected Ash and his friends from Yveltal's Oblivion Wing by using Aurora Beam to counter it. It then used Fairy Aura to calm Yveltal's rage, after that, Xerneas used Geomancy to returned everyone and everything Yveltal had petrified to normal.
Xerneas then began changing into its tree form. When asked if this meant that it was dying, it responded that it was simply beginning a new life.
Personality and Characteristics
Xerneas is a kind and caring Pokémon that is helpful to everyone. It helped Dace and lots of other forest Pokémon, gave Diancie the power she needed to make a Heart Diamond, and revived all the people and Pokémon that Yveltal had petrified during its rampage.