You'll get a lot of different responses to this. Some would say it's all self-defence against western imperialism. I wish I believed that (I did in the years after 9/11), but unfortunately I now think that's a leftist academic's beer goggles view of the situation. "Everything was economic inequality", they say.
Personally, the answer I'd present at this point is: desperate and humiliated* Muslims turned to a back-to-basics vision of Islam... and it's important to remember how Islam was in its first centuries. It was a God-sanctioned form of government that was considered "destined" to rule over the old world (including and especially Europe, where it was presumed to "patch" the outdated corruption of God's word that was Christendom). Muslims were very surprised when they were halted in their conquering of Europe at the Battle of Tours, because their eventual dominance over that land was promised by God. And they've grown increasingly confused by Islam's more recent shrinking dominance in the world, considering it contradicts what God promised them.
*So while these radical Muslims might have been made destitute and susceptible to extremist thinking by the humiliation of western imperialism (that's a side question), their ideology is not to strike back at the West, per se, but to restore Islam to political dominance on the earth. The West is merely the main obstacle to this project. They have a black and white reading of their religion, and it claims to be political destiny for the earth. They're working to make it happen. And terrorist attacks are the limited means they have to push the world in this direction.