An exchange between Captain Barbossa of the Black Pearl and his captive Elizabeth "Turner" (i.e., Swann) tells the tale:
Elizabeth: It's a pirate medallion.
Barbossa: This is Aztec gold. One of 882 identical pieces they delivered in a stone chest to Cortes himself. Blood money paid to stem the slaughter he wreaked upon them with his armies. But the greed of Cortes was insatiable. So the heathen gods placed upon the gold...a terrible curse. Any mortal that removes but a piece from that stone chest shall be punished for eternity.
Elizabeth: I hardly believe in ghost stories anymore, Captain Barbossa.
Barbossa: Aye, that's exactly what I thought when we were first told the tale. Buried on an island that cannot be found except for those who know where it is. Find it, we did. There be the chest, inside be the gold, we took them all. Spent them and traded them. We frittered them away on drink and food and pleasurable company. The more we gave them away, the more we came to realize...the drink would not satisfy, food turned to ash in our mouths, and all the pleasurable company in the world could not slake our lust. We are cursed men, Miss Turner. Compelled by greed we were, and now we are consumed by it. There is one way we can end our curse. All the scattered pieces of the Aztec gold must be restored and the blood repaid. Thanks to ye we have the final piece.
Elizabeth: And the blood to be repaid?
Barbossa: That's why there's no sense to be killing ye...yet.
This is consistent with the series' take on race. In the first two movies, all the major characters are white. There's no recognition that the Caribbean was a multicultural place. That the majority of the people in this location should've been nonwhite.
At least this time the Indian gods placed the curse, not the Indians themselves. That keeps the supernatural element where it belongs: in the supernatural. Moreover, the gods placed this curse to avenge the wrongs done to their people. And not because they or the Indians were inherently evil.
For all my postings on the Pirates series, see Cannibals of the Caribbean.