I know that for millennia, people/businesses have negotiated "loans" (at various rates), but with respect to the more formalized and somewhat "regulated" version of that, it apparently started in the U.S. during WWII, where what was dubbed "Regulation W", began a process to reign in inflation and regulate the interest rates on the credit/"revolving" accounts that started popping up -
https://www.federalreservehistory.org/essays/feds-role-during-wwii
The Federal Reserve focused on supporting war financing while minimizing inflationary consequences. Inflation was a fear because wartime policies increased incomes, employment, and the money supply, while restricting the available supply of consumer goods. When more money chases fewer goods, prices typically rise. To prevent price increases from undermining the war effort, the government instituted an array of programs. These included regulations on the prices of goods and wages of workers and a rationing program for scarce commodities and consumer durables. The Federal Reserve aided these efforts by regulating consumer credit. The Boards Regulation W imposed large down payments and short maturities on loans to purchase a wide range of consumer durables. Installment loans were limited to twelve months. Single-payment loans were limited to ninety days.
Subsequent laws modified this and over the years, states started regulating how much they could charge for interest rates, enacting anti-usury laws. And then a major case hit the SCOTUS -
Marquette National Bank of Minneapolis v. First of Omaha Service Corporation, which upended the process when it came to "nationally chartered" banks, where those that offered cards in any state, could domicile in a state allowing them to charge a higher rate than others, but have that rate apply in any other state, regardless of what that state's "max" rate was by state law.
You would see many South Dakota and Delaware-domiciled banks here in the U.S. because of that.
In any case, the Diner's Club card was supposedly the first "credit card" (starting ~1950), but with the amount paid off each month. Eventually there were cards with "revolving" credit (balances carried over month to month).
What I found ironic is that I remember when my agency began to transition from doing "cash advances" for lodging/meals/transportation when going on trips (I think either in the late '80s or early '90s), to use a "government credit card" (GSA contract), which that first go-around, was a Diner's Club card. The nightmare of that card was that so few places took them.
Over the years, the contract cards changed to be American Express, then Mastercard, etc.