It originated simply to accommodate traders and merchants. They could have been expecting some money in the near future and could borrow money from a lender to make do in the meantime. The merchant could be expecting a shipment of grain for example. The word credit has it’s etymological root in “credos”, meaning “I trust”. So the creditor was trusting the debtor and providing him with the credit, trusting he will pay it back. Paying interest is one of the ways to compensate the creditor for taking the risk in lending.
The origins of the United States was rooted in encouraging free enterprise and entrepreneurs. So it had the bankruptcy law to support failed businesses to clean their unfulfilled obligations and start again somewhere. This was a way around the debtors’ prisons and debt slavery which was seen in the histories of other countries.
However in recent times, bankruptcy has been used mainly for personal debt by individuals. 97% of bankruptcies are filed by individuals, not businesses. These are mainly caused by hardships and medical debts. This, I think, speaks to the dire state of the healthcare system and the poor knowledge of personal finance in the United States.