Much, if not all, of the $40 billion was money lent by international organizations to corrupt, US-backed dictatorships that have since fallen. The debt and its yearly interest, however, remained a massive burden on the still fragile economies of many African nations. Because of the billions spent each year by those goverments attempting to pay off interest on debt that could never be repaid, millions are starving and lack the education necessary to remedy that situation. Erasing the debt is not only logical, but also entirely humanitarian.
It is true that the money is not that of the American Government, and that we are doing little to repay the money to whom it is owed, but the organizations have more than enough capital sitting around to take the hit from debt relief.