That depends on who you think the "attackers" are.
If you think it was Osama Bin Laden leading 19 men with box cutters then you can find the answer in his fatwa...
http://www.pbs.org/newshour/terrorism/international/fatwa_1996.html
"It should not be hidden from you that the people of Islam had suffered from aggression, iniquity and injustice imposed on them by the Zionist-Crusaders alliance and their collaborators; to the extent that the Muslims blood became the cheapest and their wealth as loot in the hands of the enemies. Their blood was spilled in Palestine and Iraq. The horrifying pictures of the massacre of Qana, in Lebanon are still fresh in our memory. Massacres in Tajakestan, Burma, Cashmere, Assam, Philippine, Fatani, Ogadin, Somalia, Erithria, Chechnia and in Bosnia-Herzegovina took place, massacres that send shivers in the body and shake the conscience. All of this and the world watch and hear, and not only didn't respond to these atrocities, but also with a clear conspiracy between the USA and its' allies and under the cover of the iniquitous United Nations, the dispossessed people were even prevented from obtaining arms to defend themselves."
"People are fully concerned about their every day livings; every body talks about the deterioration of the economy, inflation, ever increasing debts and jails full of prisoners. Government employees with limited income talk about debts of ten thousands and hundred thousands of Saudi Riyals . They complain that the value of the Riyal is greatly and continuously deteriorating among most of the main currencies. Great merchants and contractors speak about hundreds and thousands of million Riyals owed to them by the government. More than three hundred forty billions of Riyal owed by the government to the people in addition to the daily accumulated interest, let alone the foreign debt."
In other words, they hate us for meddling in their affairs, and building military bases on their lands.
Or, if you think our government was complicit in the attacks, and I find it hard to believe they weren't considering 4 aircraft were hijacked and more than an hour later the airspace above the Pentagon was still insecure, then the reason is this...
From the PNAC...
One of the core missions outlined in the 2000 report Rebuilding America's Defenses is "fight and decisively win multiple, simultaneous major theater wars."[26]
The report also states:
"Further, the process of transformation, even if it brings revolutionary change, is likely to be a long one, absent some catastrophic and catalyzing event – like a new Pearl Harbor"
http://en.wikipedia.org/wiki/Project_for_the_New_American_Century
In other words, it was allowed to happen so the neo-cons could gain public support so we could go into multiple wars in the Middle East.