Um, as I recall it was US who invaded THEM, a sovereign state. Truth hurts sometimes.
Who knows to which 'them' you are referring, but let's analyze the two most obvious answers so maybe you'll learn something that didn't come from the mouth of a propagandist.
The Taliban condoned and funded Al Qaeda operations from their position as the 'government' leaders in Afghanistan. They were a direct link to the 9/11 attacks, which were then considered an act of war, and as such, the US responded in kind by forcibly removing them from power. They attacked the US (a sovereign state)
FIRST. Now, why did they hate the US in the first place? Had the US, the United Kingdom, West Germany and the rest of the middle-eastern states, not armed and trained the Mujahideen within Afghanistan in the first place, they would have become part of the USSR in the early 1980's. Since the failed invasion, the US and it's partners did indeed 'leave them out to dry.' Deplorable? Certainly. A good enough reason to preach hate for a generation, culminating in an ever-more deplorable attack? I don't know, how badly would someone need to hurt you in order for you to hate and kill them for it? You tell me, IS IT JUSTIFIED!? Are the deaths of Soldiers trying to do their jobs and the 'right thing' JUSTIFIED because of what the US and a few other NATO members did (or didn't) do for the people fighting the Soviet Invasion of Afghanistan that happened before these Soldiers were even BORN!? The only human answer, of course, is 'no.'
In Iraq, which I am sure is what you are trying to reference, it was Saddam and his regime that continually refused UN inspectors' access to facilities believed to be producing weapons of mass destruction. Given Saddam's track record of producing chemical weapons to purge his own perceived dissenters, the refusals of access did not require a great deal of faith to expect that they were being developed and hidden from the inspectors. Due to the UN's complete inaction, the US 'picked up the ball' as it were, and threatened invasion. Saddam called the 'bluff' by continuing to refuse and quite plainly lost his head.
Only since Saddam's iron fist was removed, have we seen the extremists blowing things up, which have filtered in from neighboring countries and been recruited by the already-present charismatic religious extremists that are now
free to speak their (however unfortunate for the US) beliefs. The US, UK, Australia, and Poland were willing to do the UN's dirty work for the intended benefit of everyone everyone else. Now look at the global perceptions of the US and to a lesser degree, the UK and Australia. That'll teach them for trying to do the right thing, by George!
You also seem to believe that the forces left in Iraq are attempting to subjugate the entire populace while it fights back in whatever manner it can. Considering the anti-war propaganda some morons (especially those in the US) are spewing from their collective rectums, that probably shouldn't be entirely surprising. It could not be, however, any further from the truth. These new mujahideen and jihadists only care about having their cause, because of typical
human greed for wealth, power, and the
opportunity to hurt the US on the whole as much as possible because of their past betrayal. While the insurgents themselves may have had their ignorance preyed upon by anti-US and religious extremists, the puppet masters aren't bloody stupid. If they truly only wanted the US soldiers to leave, they would stop the attacks. They quite obviously like the troops being there, otherwise they would have no easy access to an enemy to rally against other than other Muslims or their own government, not that the distinction truly matters to some of them.