Well the story with Afghanistan was that the Taliban (a sort of Islamic movement to impose religious law and government) with Pakistan's managed to take over most of the country and maintain firm control after a big ol' civil war. The Taliban did a whole lot of unpleasant stuff, there were massacres, and a bunch Sharia law stuff, but the thing America really cared about was that they let Al Qaeda openly use the place as a base of operations and even helped fund them. The war was started to stop Afghanistan supporting Al Qaeda, because Al Qaeda had attacked the US by hijacking some planes, you may have heard of that part. So the US supported the other two factions that had fought against the Taliban and took control of the populated southern areas. Then it got into a protracted guerilla fight with the Taliban forces who could in no way fight them openly. They've been mainly hiding in mountain strongholds, and among sympathetic civilian populations, and over the border with Pakistan and some other areas, and it's just been dragging on like that.
There's a heck of a lot more to it than that, but that's the basic gist of it. If the main objective was to stop Al Qaeda from using Afghanistan as a base of operations, then I guess it's been somewhat successful.