Mohsin Hamid, a Pakistani American, writes about this in the Washington Post:
Part of the reason people abroad resent the United States is something Americans can do very little about: envy. The richest, most powerful country in the world attracts the jealousy of others in much the same way that the richest, most powerful man in a small town attracts the jealousy of others. It will come his way no matter how kind, generous or humble he may be.
But there is another major reason for anti-Americanism: the accreted residue of many years of U.S. foreign policies. These policies are unknown to most Americans. They form only minor footnotes in U.S. history. But they are the chapter titles of the histories of other countries, where they have had enormous consequences. America's strength has made it a sort of Gulliver in world affairs: By wiggling its toes it can, often inadvertently, break the arm of a Lilliputian.
The residue of U.S. foreign policy coats much of the world. It is the other part of the answer to the question, "Why do they hate us?" Simply because America has -- often for what seemed good reasons at the time -- intervened to shape the destinies of other countries and then, as a nation, walked away.
There is so much about the United States that I admire. So when I speak of that time now, and encounter the pose of wounded innocence that is the most common American response, I am annoyed and disappointed. It is as though the notion of U.S. responsibility applies only within the 50 states, and I have no right to invoke it.
Americans need to educate themselves, from elementary school onward, about what their country has done abroad. And they need to play a more active role in ensuring that what the United States does abroad is not merely in keeping with a foreign policy elite's sense of realpolitik but also with the American public's own sense of American values.
Because at their core, those values are sound. That is why, even in places where you'll find virulent anti-Americanism, you'll also find enormous affection for things American. That's why Pakistani rock musicians listen to Jimi Hendrix and Nirvana, why Pakistani cities are full of kids wearing blue jeans and T-shirts, and why Pakistanis have been protesting to give their supreme court the same protection from meddling by their president held by its model: the Supreme Court of the United States.
All of which leads us to another, perhaps more fruitful question that Americans ought to consider: "Why do they love us?" People abroad admire Americans not because they back foreign dictators but because they believe that all men and all women are created equal. That concept cannot stop at the borders of the United States. It is a concept far greater than any one nation, no matter how great that nation is. For America to be true to itself, its people must broaden their belief in equality to include the men and women of the world.
The challenge that the United States faces today boils down to a choice. It can insist on its primacy as a superpower, or it can accept the universality of its values. If it chooses the former, it will heighten the resentment of foreigners and increase the likelihood of visiting disaster upon distant populations -- and vice versa. If it chooses the latter, it will discover something it appears to have forgotten: that the world is full of potential allies.