The Medrash Rabbah (18:4) relates that when Hashem told Moshe: "Take the Leviim... and pass a razor over their flesh (Bamidbor 8:7)", he immediately did so to Korach. He cut off his hair according to Hashem's command.
Korach then walked around to his fellow Yidden but they didn't recognize him. They asked him who did this to him, and he answered that Moshe had done it. Right then, Moshe's enemies began to rile him up and persuade others to oppose him.
Sefer Agra D'Kallah says that this is hinted to in the Torah. The Parshah begins by saying that "Korach took", but it doesn't say what he took. He thus explains it to mean that he took "Korach", which can be translated to mean that he took "his baldness" - in other words, he took badly to the haircut he was forced to get, and this led to him opposing Moshe.
He goes on to say that the reason there was a commandment to cut the hair of the Leviim is because hair represents “dinim", harsh judgments. Thus, once Korach saw that he no longer had hair, he thought that he was about judgment and he could serve as the leading kohen with no fear. He took this mindset as a reason to oppose Moshe for the leadership of the nation.