God continuously warns Balaam, "Do not go beyond what I tell you to do," and every time, Balaam tries to anyway. He fights God at every turn because He wants his own way. He wants the gold, the honor, and the reputation he would have by cursing Israel (who had defeated mighty Egypt and most of the nations they came in contact with). The true God was the "game in town," and if Balaam beat Him, he would be on the top of the pile. This is Balaam's plan; he was "working his magic," trying to move himself into first position among diviners.
This brings out his major flaw, one that many in the world also have. He believed that the end justifies the means. He was willing to set aside principle (if he had any) to achieve his goals. He functioned by self-interest rather than by belief or standards. His standard was "anything that is good for Balaam," which is self-righteousness and self-interest. These were the principles by which he felt he could live a successful life. He did not base them on anything godly or even ethical but strictly on human reason.
He was willing to do anything to get his way. By putting together different parts of the Bible on him, Balaam comes out smelling like manure, not roses.