Oh dear. How do I put this?
Okay, so when MX and Terra joined. Terra made it so that he and MX both lost their memories. This led to Terra's heart becoming Xehanort's heart. (Not to be confused with MX). Really, they are the same person. Due to Braig and MX's heart, Xehanort became evil dabbling in learning about darkness. He banished Ansem into the world of Nothigness and took his name. Then he became a heartless. (The heart that was taken to do so was MX's.) His Nobody gained Terra's/Xehanort's heart and memories. This gave Xemnas the ability to feel anger and other such negative emotions. So, ultimatly, Xemnas has Terra's body and his heart. Although, he has no memories of ever being Terra.