God created man in his “image” (Genesis 1:26-27), which means that man has the ability to reason and to make choices. God could have made man a robot to always do what is right, but then he would not be in God’s “image.”  God could have shielded man from Satan’s temptation, but then man would still have been subject to ambitions from within. In God’s wisdom, He foreknew that Adam would sin.  However, Adam was master of his own God-given free will and could have chosen to obey God’s command.

God always allows humankind the option of choosing righteousness or sinfulness, just as He allowed Adam that choice. When God expelled disobedient Adam and Eve from his fellowship they began to “know good and evil” (Genesis 3:22) and to appreciate the difference. During all the centuries thereafter humankind has been learning the same lesson as well.

Although God has a plan for the entire human race, He has not planned every detail of each person’s life when that detail has no impact on His grand plan.  For example, the nation of Israel has always played an important role in God’s plan. After all, it was from this nation that Messiah was to come.  For example, in the books of Isaiah and Amos, God said He would protect Israel from disasters if they were faithful, but if they forsook Him, He would bring calamities upon them.  (See Isaiah 45:7 and Amos 3:6.) Here we see that because of some of Israel’s poor choices, they were chastised with a “calamity” or trouble sent by God.  This trouble could have been avoided had the people obeyed God.  They had a free will and chose evil rather than righteousness.

Another example of free choice was displayed by the nation of Nineveh.  God commissioned the Prophet Jonah to go to the city of Nineveh and preach against it because of its wickedness. Jonah told the Ninevites that in forty days their city would be overturned. The Ninevites declared a fast and put on sackcloth.  When God saw what they did and how they turned from their evil ways, he had compassion and did not execute the destruction he had threatened (Jonah 3:10).

It is important to remember that God does not plan out every detail of our lives. We definitely have free will and are not subject to a pre-ordained destiny.  We are on earth to learn lessons in this age that will benefit us in the glorious age of redemption to come. Although Jesus died for every man, woman and child who ever lived in order to give each one an opportunity for everlasting life in the future, each is nevertheless ultimately responsible for his own destiny.  If a person continues to sin during the Day of Judgment, he will be taken away in the second death.  God will never take away a human’s free will.  It is the choice of each individual as to whether he or she chooses righteousness or not.

You asked how God could be “angered” by something if he planned it.  It is important to remember that God does NOT control or plan the actions of humans. As we stated in the previous paragraphs, humans have freedom of choice. Therefore, God’s anger is totally justified when humans deliberately choose to ignore his laws and willfully sin.  A familiar episode of God’s wrath is the destruction of Sodom and Gomorrah due to the wickedness practiced by all the inhabitants except Lot and his family. (See Genesis 18:16-33; 19:1-29.)  Although God was very angered by the lawlessness of the people and foresaw the destruction of their cities, He never predestined the people to act wickedly.
Their actions were of their own choosing. Had they been repentant, God would not have been angered and their cities would not have been destroyed.