Banks have always made money by taking deposits from customers and lending that money to borrowers. Banks choose to lend because loans produce strong returns and are considered to be one of the most stable types of investment (often called an "asset class").
The asset class of loans has a track record of being more stable than stocks and shares and other popular investments.
Of course, if you were to invest in a single loan your investment may not turn out to be very stable. Sometimes borrowers miss a payment – it happens.
That's where scale is important. Banks lend to thousands, even millions of people, and this scale helps them to achieve an investment performance that is based on the portfolio average.