You may think that money is invented to make exchange easier. You could imagine that at some point in prehistory. A hunter just shot a deer and a farmer has some carrots and they want to exchange but the meat is worth much more than the carrots. They need to invent something to pay each other the difference. In this story, that's something would be money, be it in the form of shells or lumps of gold or silver or whatever.
Later in the story, banks would appear to store the money and to lend out money from people who have too much money, who are the savers, to those who have too little money, the investors. That's when credit and debt systems appeared. Money came first and then credit and debt in this story. The problem with this story is it may sound plausible, but there is very little historical or archeological evidence for it, plus it has some logical problems.
There's a lot evidence and arguments to believe that debt came first and money later when people started to use their debt tokens, their debt symbols as money. Now, why would this be the case? In the first place, it would be logical because of seasonal production. In Asian societies dependent on seasonal production, food and other products come onto the market at different times of the year. The farmer perhaps has not yet harvested the carrots while the hunter already shot the deer with no fridge to keep it in. What do they do? The farmer accepts the meat now on the promise that he will pay the carrots later as they come available. At this moment, the farmer has accepted a debt, which is a promise to pay the hunter in the future.
Here, we have a relation between a creditor and a debtor. Now, with more people than just these two in anyone's society and with different products, you can imagine you quickly get a complex web of credit relations. Also, each debt contracts may have a lot of detail, not only how much is owed but also when it needs repaying, in what form, what the interest is and so on. For all these, you will need a system to record it.
The upstart is as soon as you had specialization of production with different people producing different things at different times of the year, then you need to record credit and debt, what we now call double entry bookkeeping. Albert Einstein seems to have said that, "Humanity made three great inventions in prehistory: fire, the wheel and double-entry bookkeeping."
Now, this is all really interesting but how does money come in and why do we need to know all these. Money is simply debt symbols, debt tokens which are used as payments. After all, a debt is a claim on future goods and services as we just saw. It's really worth something and that means you can pay with it. Let's say the debt is written on a clay tablet. The hunter can now use the tablets to pay somewhere else like a fisherman.
As the debt tokens are moved out that particular trading relationship, there will also be the need for some external authority to assert their value, like kings or chiefs proclaiming the value of money. This also opens up the possibility of central clearing, which greatly simplifies things.
Watch the full documentary now (playlist)