I think a lot of people sort of miss that Nomura never treated YX, Chessnort, Xemnas, Ansem, and MX as truly unique individuals of their own but rather all extensions of one guy. They are just the same one guy but at different stages of life and who manifest slightly different parts of their personality based on their own individualized experiences. To fully understand Xehanort's story you have to look at him as a whole character.
YX is the arrogant boy who is drunk on the idea of getting to live this grand role in the world out, getting to live a full life, getting to make a new world, etc.. and believes strongly in the idea that fate can't be changed which means all his atrocities are justified. This boy forms the core Xehanort and is what Xehanort becomes when he's influenced by others like the MoM and his own future selves, easily corruptible. He goes out refusing to acknowledge his losses or even that things could potentially be changed, he goes out basically flaunting how HE is the real winner because he gets to go back and live his life to its end while Sora is done in this world. Woody also roasts him by making it clear one of his issues is that he's hollow brat no one loves, of course it's not entirely accurate as there are a few people who did but he largely grow up alone and so his love was minimal not to mention he ultimately shed his loved ones which factors into later. But it's critical in keeping in mind as a child he already threw away his home once.
Chessnort is brighter and happier because even though he's easily influenced, at that moment his influence are people like Young Eraqus and their master, people who are good and fight for the forces of light. However you can see in him the troublesome signs that will lead to his fall, his curiosity that leads to his corruption, his feeling that time can't be changed, and his admiration of Eraqus. He admired Eraqus and was a bit star struck by him, he wanted to be his equal and right by his side, but according to him Eraqus was just better. The only way he could see himself keeping up is if he tapped into the power of darkness, wielding light and darkness is how he believed he could keep from falling behind. This is also where we see the early signs that Xehanort has a power obsession, a belief that power is the answer to problems and being strong is necessary. Finally we get an interesting little note, according to Chess Eraqus Xehanort doesn't admit when he loses.
We fast forward 70-ish years to Master Xehanort and he is pretty much the same person as he was when he was a kid, and that's the problem. He still believes destiny is set in stone, his friendship with Eraqus has soured because Eraqus grew up into a light Xealot instead of the hero and leader he believed he would be...and that's the key here. Because he had so much faith and trust in Eraqus when Eraqus let him down it was devastating, so he kept waiting for the world's leader to appear but it never did and in the meantime saw the world as increasingly unbalanced and ruined. Likewise his curiosity only continued to grow it was never sated and his questions were never ending. These two factors ultimately came to a peak when he realized "oh crap I'm old, my life is almost over" he wasted his whole life waiting for a leader that never came and was going to die with the view that the world was a hopeless doomed wreck and plagued by questions without answers. He couldn't accept that, he decided even if he wasn't the one meant to do it he would become the leader of the world himself and he would find the answers he is seeking. He convinced himself to take up a role he knows wasn't meant for him and he justified it to himself as being okay because he had the power to do it, in his mind the strong have a natural right to lead and shape the world and those that are weak should follow. (this is the core that leads to Xehanort as Xemnas just casually tossing any org members he views weak)
This leads us to his plans in BBS where he tries to gain the ultimate source of power, Kingdom Hearts and it's X-blade, and buy himself more time by stealing Terra's youthful body. On top of all this because he knew the X-blade required hearts of darkness and he himself was okay with darkness he decided he would play the role of the side of darkness, believing no one else really would. He would be the darkness to bring back the light and restart the world over, he's like Riku but so much more extreme.
Ansem and Xemnas are a two fer, after losing his memories and living a year as young man his mind set was changed a bit by that and his new influences Ansem the Wise and his apprentices. He found himself a kindred spirit with Subject X who was like him but then he lost her, blamed her loss on his master and had his precious experiments trashed and forbidden. These raised spite and regret in addition to regaining his old memories in the process of all this. This is a particular dark area of his life as this is where his obsession with power takes full hold. The heart is the source of all power and to that end he seeks to gain full control over it, his two halves go about this in different ways. AnsemSoD focuses on the darkness of the heart viewing it as the true source of the heart's strength, while Xemnas focuses on using the mind to completely dominate the heart. Both see the heart in this sterile robotic manner and in their obsession for power and in their beliefs they lose sight of everything else. Like when he was a boy and later again in life, before the split Apprentice Xehanort threw away everyone and everything and then after the split they did it again.
However after failure and lose again and again, and interacting with Sora and Riku, these two start to change. It's subtle but it's there and even if it's the past versions of them in KH3 they are still aware of their losses and the journey their lives take...as well as their ends. So when K3 comes they are already aware of how their story ends and pretty much how pointless their lives on this borrowed time is, they can help their self achieve their goals but they themselves can never benefit. They each realize this in their own time this and in exact opposite ways. AnsemSoD realizes this when the dusks attack, instead of feeling anger or passion he felt nothing but apathy and he also couldn't bring himself to change his fate since as far as he knows he can't. AnsemSoD ends up emotionally burnt out and his time with Riku and Sora has both disproven his theories and shown a strength vaster than darkness. In the end AnsemSoD has lived so long and instead of being excited or taking pride in his destiny he is just ready to play his role so he can move on and be done. Xemnas meanwhile won't have the realization hit him till he is bested by Sora one last fight and where as AnsemSoD feels emotional burnout Xemnas feels overwhelming emotion, the weight of what he has thrown away and sacrificed and how he has gotten nothing in return hits him like a ton of bricks and there is a sense if he could keep his memories of this he might change but he knows he won't. However this shows us the capacity to change if he is shaken enough exists inside Xehanort.
This takes us back to Master Xehanort the one who can still benefit so he's still gung ho about what he's doing but he loses, he loses utterly and completely and still just like when he was a kid he couldn't admit he lost. He is dying, there is no hope for him now but as long as he manages to hold onto life just long enough for the world to reset he still wins. Sora and Xehanort enter a battle of wills and Xehanort loses out, that's when he starts to think back to Eraqus and not long after Eraqus appears. Instead of make things better he is initially hostile to Eraqus and insists HE can do this, he can be the leader Eraqus failed him to be. Eraqus looks sad because he understands why Xehanort is like this but he tries to make him see reason that while both of them failed it's not too late for the kids behind them to build a better world. When he walks over to MX and says checkmate that makes Master Xehanort think back to his time as a kid, of the person he used to be, and that's when he remembers there was a time in his life he wanted to be there supporting Eraqus. Now it's too late for Eraqus and him but he CAN still be there for their replacement, and so that's what he does he walks over to Sora congratulating him on the utter defeat he dealt him and hands over the X-blade. This is that capacity for change if shaken that we saw in Ansem and Xemnas manifesting here, as well as the desire to be done, and as her perishes he turns back into the chessnort because in his heart that's who he is. It's not a redemption but rather his arc coming in full circle.
He wasn't redeemed as he never really stopped thinking he was right and no one forgave him, but he did find peace in his loss and failure...a release and return to a promise that actually mattered to him. To the one friend who despite throwing away never really left, the one guy who showed Xehanort a form of love. Maybe it feels a better end than he deserves but this is also a disney fairytale so this kind of ending with the bad guy dying but rekindling a lost friendship is right up the alley.