2 Peter 2:15-16 tells us the reason for God's anger with him. In Numbers 22 Balaam is told that he may accompany the officials of Balak the king of Moab IF he will do only what God instructs him to do. Balaam had no intention of doing such a thing. His heart was full of greed and he fully intended to earn his fee from Balak by cursing Israel. He thought he could outwit God. He couldn't.
I hope you have found this helpful.