Something I always wondered. After beating Terranort at Radiant Garden, it looks like Terra and Xehanort are struggling for control. Terranort then says "Get out of my heart" and then stabs himself with his keyblade. Was that Terra, or Xehanort locking away his heart, thus causing the amnesia? With the way everything plays out afterward, I'm guessing Xehanort was the one that did it? --- Sorry, bout your damn luck!!!
Terra was fighting back, so Xehanort told him to stop interfering. Xehanort then tried to release Terra's heart from his body, but failed miserably. --- Official Luxord of the Kingdom Hearts: Birth By Sleep Board
Yeah. He seemed to want to consume Terra's heart as well as keep his body but when it wasn't working out he decided to just kick it out and keep his body. Similar to how Ansem SOD simply tossed out Riku's heart in KH1 when he started resisting him.
However he either messed up the process, or Terra's heart was too strong for him to do that, as he instead locked them both away.