Question: how did xion come back?
Answer: Performing experiments in Toy Story, BH6, and bringing Vexen back into the organization. They created a new Xion and then Xion's heart transferred and awakened inside of that Replica when Sora connected to it, that's why the replica starts to spaz out and Axel regains his memories.