Question: how can xehanort time travel?
Answer: Master Xehanort first gained the ability to transcend time in the end of Birth By Sleep. Having believed the X-Blade to be forged, Xehanort used his own Keyblade to remove his heart and cast aside his old body in favour of Terra's new one. This act gave him the ability to transcend time.