The names “United States” or “US” refer to different entities here. With regards to the debt, they’re referring to the government of the country. With regards to the GDP, they’re referring to all the businesses of the country. So the government owes several trillions of dollars to those who have purchased treasury bonds, and the businesses of the country produce (every year) an even larger amount of money in profits. But the government only taxes a portion of those profits, and so it would take far longer than just a few years, to pay off all of the debt — and also (at least recently) the government keeps spending more than it collects in taxes, so it is simply getting further and further into debt.
A similar situation is going on with the world as a whole. When talking about the debt of various countries, what people are really discussing are the debts of the various governments of those countries. Basically, the governments of the world owe large sums of money to the businesses (and individuals) of the world. They also tax those businesses (and individuals) every year, and use those taxes to pay back (some of) the debts. But when (say) England owes money to the US and the US owes money to China, there’s no way to really “cancel out” the debt and just say that England owes China, because it’s the government of England who owes money to citizens in the US, and it’s the government of the US who owes money to the citizens of China, and so forth. Sometimes governments owe other governments money, but it’s often simpler to just keep track of the debts rather than try to cancel them out.