Habakkuk was written just before Judah was to fall to Babylon. Habakkuk is upset with God because he sees his fellow Jews disobeying God who doesn’t seem to be doing anything about it. God says he will take care of it by having Babylon invade. Habakkuk finds that answer even more disturbing because Babylon is much more wicked than Judah.
This interaction shows an interesting problem in human thinking. It goes something like this: since I’m better than my neighbor, I must be pretty good, and since my neighbors are better than those people, that makes me really good. God’s not interested in our comparisons to others; he wants our full devotion to him. Habakkuk gets there in chapter 3 when he promises to follow God no matter what.