Ansem considered all of his apprentices to be precious to him. Wouldn't be surprised if there were portraits of all of them somewhere in the castle.
Also the information about the Door to Darkness was behind Xehanort's portrait which is in direct relation to how it was Xehanort who opened the door under the castle that let the Heartless in.
Essentially, shh don't think about it. Back during KH2 days, Xehanort was AtW's star pupil. With BBS, we find out he hadn't even been around for all that long so in retrospect it is weird for him to have that painting but during KH2 it was to be assumed AtW and Apprentice Xehanort were actually very close in a mentor-mentoree way that almost bordered a familial relationship. It isn't so odd to have a painting of somebody that was almost like a son.