The US-Afghanistan War began with the 2001 invasion of Afghanistan. It was sold to the American public as retaliation against al Qaeda and Osama bin Laden for the 9/11 terrorist attacks as well as an effort to remove the Taliban from power and restore democracy to Afghanistan.
It has now continued for nearly ten years with no end in sight (despite many promises from President Obama). Although there have been some improvements the lives of the Afghan citizenry, it's not clear that they have benefited overall.
It seems likely that the primary reason the US is still fighting in Afghanistan is the immense profits made by war contractors and their consequent support of pro-war politicians and messages in the US, especially in the aftermath of the Citizens United decision which essentially allows money to rule the outcome of US elections.
The Bush-Cheney administration stated that it would not distinguish between terrorist organizations and any nations or governments that harbored those organizations -- yet the US remained close friends with Saudi Arabia, one of the few nations to give diplomatic recognition to the Taliban, and home to the majority of the 9/11 terrorists. (See Bush administration hypocrisy.)