My best guess . . . initially the invasion was a beard for, and a foot-in-the-door to, the Iraq invasion.
Now that it’s eight years later, . . .
. . . Now that it’s eight years later, I suspect that a very significant reason is because the Afghan region is the last contiguous land area on the planet that is totally outside the control of the network of international corporations. Therefore it poses the risk of acting as a "bad example" to the rest of the world regarding an ongoing exercise in a different type of government. As a loyal corporate employee, President Obama has little choice but to continue.
Even though seriously flawed and backward, the Afghan region is a network of tribal chiefs and clerics with militias who control the major decision making in those mountains, plains, and valleys; not the major corporations of capitalism.
As long as a Monsanto marketing executive cannot decide what type of seeds are sold at market, if Coca-Cola's regional manager cannot monopolize which sugar-saturated carbonated beverage is sold in stores and bars, if Toyota's distributor network can't safely sell small trucks & generators, etc., etc., etc., the threat to corporate rule of the planet, no matter how marginal, might somehow mutate and spread.
The Army of the USA, acting under orders from the best political system that corporations can buy, is working to exterminate the last example of an economic system operating outside of corporate control. As Noam Chomsky said about Vietnam, it is the threat of a "bad example", rather than any rational military threat, that must be squashed. The "terrorist" threat is a ruse, as any intelligent person realizes.
I am not endorsing the tribal rulers of the Middle East and the worst of their practices. I am just suggesting another plausible rational for the continuing, seemingly counterproductive "war against terror", at least from the perspective of those politicians and generals who feel comfortable committing war crimes for their corporate sponsors.
Oh, yeah . . . and in the tradition of all wars, plenty of millionaires are workin' hard at becoming billionaires, both at home and abroad. It is one of the few growth areas of the nation's economy.