In the beginning there was no money, there was just barter. But if you were a rich coconut farmer who wanted a Lamborghini, you had to find a person who needed that many coconuts and had a Lamborghini to pay for the coconuts with. And this was very hard to do.
Over thousands of years, people decided on bartering for certainly commonly-desired non-perishable easily-dividable hard-to-adulterate commodities like gold/silver which became world currency.
But gold and silver was hard to carry, and not secure enough, so people deposited their gold with trustworthy vault owners, and got a bearer’s receipt instead. Anyone who held the receipt could get back the gold from the vault owner. Soon people started paying each other in these receipts (which became known as notes) since anyone with the receipt could get back the gold.
Since only very few people came back to collect the gold with their receipts, The vault owners also got into the business of lending money deposited in their vaults. Although the Catholics and Muslims thought lending money for interest was evil, after the protestant movement, the Calvinists (and eventually all Christians), started believing a low interest rate was a good thing. But society was still against high interest rates.
Soon the vault owners (now called banks) started lending almost all the deposits they had for interest. Occasionally all the depositors would come with their receipts (also called notes) to withdraw their deposits, and the vault owners did not have enough gold to pay the depositors with because it was all with the borrowers.
After many such incidents of vault owners not being able to pay the depositors back (such incidents were called bank runs), governments decided to step in and allow certain banks (called central banks) to print notes (not backed by gold or silver) to lend to banks experiencing bank runs. The normal banks could then safely lend out all of their deposits, and Governments also got a source for newly minted low interest money, which they could use to engage in vote securing (legitimacy building) projects like welfare and wars which also made the government contractors happy.
In USA, the current central bank chartered to print money (without having gold) is called Federal Reserve, which profit by, among other things, lending money to banks which run out of money to pay their depositors. The Federal Reserve also lends newly minted money at very low interest to the US government which is why US government wants them to exist.
For every dollar print and lend by the Federal Reserve to the US government, the government contractors get paid with it and they deposit it in normal banks who lend it out for more interest which the normal banks lend to the people and to US government, until there is upto 9 more dollars owed by banks, governments and people to each other (as promises to pay). This is called money multiplier effect, and is used to “stimulate” the economy.
Unlike in the old days when people decided that gold/silver was currency, now people indirectly accept that what we owe to each other (as promises) is money. Theoretically there is no limit to what we can owe each other, as long as we know we can meet those promises, and as long as we can keep track of those promises and measure it in money.
Governments are widely believed to be capable of meeting any promises they make (through their threat of tyranny). They can promise to pay back the Federal Reserve a quintillion dollars, after borrowing from them, but they have to be careful not to create runaway inflation with it, e.g. runaway food prices, during high unemployment, or else the governments will face widespread civil disobedience. This is also why governments make sure they don’t run into civil disobedience scenarios by controlling what is shown in media, and Facebook walls.
So this is why governments end up borrowing so much money because they believe they can secure their legitimacy, avoid civil disobedience, through welfare and wars, by making promises to pay back what they borrowed from banks, promises which the govts plan to keep through a threat of tyranny (taxes and guns). Besides the government contractors, i.e. Health Insurance companies, and weapons manufacturers also like this arrangement.
How demand for a currency is maintained in international markets
Money that is not backed by gold or silver, presents a new challenge for a nation. How does it maintain demand of their currency in the international markets? This is how it is done:
Countries possessing superior technology, products or services offer these to nations which do not have them. These superior nations also lend their currency to poorer nations for interest, so that the poor nation can pay for the technology. The lender nations also create new money so that borrower nations can buy it with their local currency and pay the interest with it. The local currency is held as ransom by the lender nation. If they borrower defaults or if there is an unsustainable trade deficit, the lender sells the borrower currency until the exchange rate between the borrower’s currency and lender’s currency changes.
This way plenty of borrower nations maintain a constant demand for the lender’s currency in order to pay of debts. This makes lender’s currency more valuable in international markets.