There are some major difference between Iraq and Afghanistan. Although both nations have about the same population (25 million in Iraq, about 15 percent more in Afghanistan), Afghanistan is fifty percent larger (647,500 square kilometers). The Iraqi GDP is over $90 billion, while that of Afghanistan is closer to $15 billion. Afghanistan is the poorest nation in Eurasia. There are several obvious reasons for this. First, it's hard to get around in Afghanistan. There are few roads, fewer navigable rivers and no railroads. There are lots of mountains. In Iraq, the literacy rate is 85 percent, and nearly all children are in school. In Afghanistan, literacy is 28 percent, and in rural areas, it's common for girls to be kept out of school, even if schools are available.
The basic problem with Afghanistan is that there are too many people living in a country that never had to support that many. For several thousand years, the population was about two million, and there was a lot more prosperity. But starting in the late 19th century, Western public health practices, and medicines (and much other helpful technology), began to reach Afghanistan. The population proceeded to explode. By 1900 there were five million Afghans. By 1950 there were nine million, and by 1975 there were 16 million. The amount of arable land had not changed. Actually, it had increased a bit, as the "Little Ice Age" (1300-1850) ended and a bit more land could be farmed. But a more than tenfold expansion of the population, and not much economic growth, led to a sharp drop in living standards.
The outside world came through, with food aid from the Soviet Union, Western nations and wealthy Persian Gulf Arab nations. While this saved lives, it also allowed the population growth to continue. With few jobs, there were a growing number of young men willing to do anything to make some money. Without some assets, marriage was impossible. So you had increasing numbers of poor, desperate and sexually frustrated men. It was socially acceptable to go outside your immediate area (which could be a fairly large river valley), engage in banditry, and be safe if you make it back home with your loot. Getting back was often difficult, as Afghanistan is still a warrior society, where honor is paramount and most adult men are armed (with a knife, if not a gun).
All this produces a very violent, divided and chaotic society. This is particularly true in the Pushtun south. The Pushtuns are a bit more everything (violent, armed, greedy and factious.) The traditional tribal structure is being torn apart by factions competing for a piece of the drug trade, or by joining a pro-Taliban faction. The drug business, and Taliban affiliation, have torn apart the increasingly fragile tribal authority. Afghan tribes were never as united as those in Iraq, but at least the tribal elders possessed sufficient respect to be used for settling disputes. Increasingly, the disputes are settled by gunfire.
U.S. troops headed to Afghanistan are being warned that the place is poor, and desperate. Factions form around those who can deliver goodies, and U.S. troops are prepared to do that. However, the locals are wary of people who are not going to stick around, and that diminishes the value of any cash, goods or other favors you pass around. The drug lords, Taliban leaders and other men wealthy enough to attract a following, are not going to rotate back to another country in a year.