Ooh boy... Talkin' about Days? You beckon the haters...
Xion looks like Sora at the end because it's what she was intended to look like. Originally, she was supposed to be an exact replica of Sora. Of course, complications happened, memories started going everywhere, and she started identifying as female...
There are two interpretations on why she attacked Roxas. One is that Xemnas did something to her to restore her back to "factory settings"- sole purpose in mind was to become a Sora clone, and if it meant killing Roxas, whatever. The other (and more popular) idea is that it was Suicide By Cop; Xion kept her free will, knew that her existence would eventually kill Roxas, and so pretended to go all axe-crazy in order to force Roxas to kill her. I know that the manga goes with idea number two.
Namine just needed those memories that Xion had managed to weave into her own identity. Having Xion die conveniently released those memories, so it worked out in the end.