It's also worth noting the context of his early forays into politics. It was during the insurgency of the Second Chechen War and there were numerous Chechen terrorist attacks throughout Russia (Beslan, Moscow theater, etc.). While it doesn't excuse or justify it, it's hardly surprising that radical, anti-government protestors/politicians would embrace xenophobia and Islamophobia at the time. His evolution as a person was evident over the past decade, and he became much more centrist. Having watched interviews with him and read some of the things he'd done, the shifts seem to be a genuine change, but it's also likely he understood that his extreme views would alienate international support.
I think this article by Masha Gessen is a good overview of his political evolution. The person who persuaded Navalny to go to the Russian marches talked about inviting him to the marches as part of an attempt to co-opt and persuade nationalists to join causes with other anti-government groups. She also mentioned that Navalny was the least-educated and sophisticated of the anti-government activists but he was always working to educate himself.
https://www.newyorker.com/news/our-columnists/the-evolution-of-alexey-navalnys-nationalism