It was likely less about resources and more strategic influence. "Owning" Afghanistan would give America the ability to project power in a critically important region surrounded by American rivals where it lacked a military presence.
https://en.wikipedia.org/wiki/List_of_United_States_military...
It boxes Iran in, it taps on China's exposed western shoulder and borders the stans that buffer Russia's soft underbelly and it's close enough to other established air bases that can provide logistical support.
Better yet, if you do manage to capture it, it's has some of the most favorable geography for repelling invasions of any country. If America was fully established there, getting it out would be pretty much impossible.
It's not a huge shocker it was seen as a prize worthy of an expensive gamble at a time when America felt it was at the peak of its power. Anyone remember fukuyama's "the end of history"? America had a pretty severe case of hubris in the 90s/early 00s.
The war was lost a while ago, of course. It's really hard to admit defeat however, and there's always a tinge of hope it might be turned around, a disbelief that the American military could suffer defeat, so, of course it dragged on.
Anybody who has worked on a huge, vastly expensive high profile project knows that inertia can drag it on for years after it's clear to everyone that it's dead in the water.