Yeah, makes no sense. Also anecdotally, I bought their EV out of concern for the environment and the thought that oil should be consumed as little as possible for geopolitical reasons.
Philip Low, a long-time peer and friend of Elon Musk offered one theory shortly after the nazi salutes: https://old.reddit.com/r/samharris/comments/1ibajmf/philip_l... (sorry about the format, couldn't find a better source)
He claims that Musk is just attracted to power and trolling, and will do both cynically instead of from any kind of principles. He guesses that Musk was worried at the time of losing the support of some actual nazis in the actual US government and wanted to signal them publically.
I'm not sure if a cynical nazi supporter is better or worse than an actual nazi. Could be worse, because those are the people who could and should be making better choices.