I don't think either really deserved to sell particularly well. Both had their problems.
FFXII had some great characters, a mature story and had plenty to do in terms of side quests and exploration. However, although the story was potentially impressive, I don't think it was told particularly well. It really did seem to be a case of unfulfilled potential, likely as a result of the change in director midway through development. The characters of Vaan and Penolope were really a bit out of place and towards the end I didn't really feel the story had been told appropriately.
FFXIII on the other hand was very linear which meant it could focus on telling the story. Unfortunately, the story was essentially a tale of teenage angst more in line with Dawsons Creek than anything else. The focus is heavily on the characters and they're developed well for the most part, but in many cases their emotions and characterisation feel out of place. For instance, I don't expect a boy of Hope's age to make emotionally mature and well thought out speeches when fairly recently he'd just seen his mother die as well as witness destruction and death on such a huge scale. Of course, the linearity was also an issue. It didn't have the core traditions we expect from a Final Fantasy; the towns; the airships; the minigames; the side quests. In fact, the only side quests were all focused around the battle system.
The pacing was off for a large chunk at the start of FFXIII, partly due to the linearity of the game resulting in it feeling like an extended intro. I actually think FFXII suffered a similar (although not quite as severe) problem but for the opposite reason. It gave the player too much to do early on in the story, leading to fragmented storytelling.
I think both games have unfulfilled potential. I would have prefered a game with the writing and story of XII mixed with the cutscenes and storytelling focus of XIII, but with additional exploration and side quests of XII. I don't think that's too much to ask is it?
You may notice I haven't actually commented on the battle systems of either game. That's actually because that's the one area I think both excelled in. I'm not actually sure which one I prefer.