America are like a slightly corrupt and violent world police.
Apparently the invasion was Oct 2001 and Bin Laden hiked over into Pakistan in Dec 2001
The government of said country was unfriendly but not actively hostile to the US and on good terms with AQ, but not outright allies. This could've been said to apply between many Middle Eastern governments and radical groups at the time.
The US decided to invade, and antagonized the formerly unfriendly Taliban to become actively hostile.
The US managed to temporarily win over the Taliban but failed to permanently displace them.
AQ leadership, including Bin Laden moved out of the country almost immediately.
The 'war on terror' went on almost without end, then Bin Laden was killed a decade later, in a different country the US didn't declare war on, thanks to US special force action.
While AQ got weaker, ISIS got stronger (honestly I don't follow ME insurgent groups that closely, I wouldn't be surprised if this was a rebrand/reorganization in part).
So the US-initiated invasion totally failed to reach its stated result while leaving a huge collateral in its wake.
Economic motivation? Not so much now, with the US being a dominant oil producer, and with petroleum itself losing importance. Even then, it's questionable if this could justify the full cost of the US military.
I think the original motivation was two fold: it was a combination of some sort of moral obligation to defend the "free world" from authoritarians, and (after WW2) a desire to keep small countries (and recent WW2 enemies) from deciding their only option for defense was their own nuclear deterrent.
Why would the world need defending from non-expansionist authoritarians?
At the same time, soft power is also vanishing.