Shorting comes (mostly) from people who believe a stock is overpriced, and then some shorting also from arbitrageurs.
A party would short a stock because they believe the price will go down in the future. Or, an arbitraguer may short a stock as part of a hedged arbitrage, for example, long etf, short components. On settlement day, they have an obligation to deliver the shares they sold. In the case of selling short, you don't have the shares that you are obligated to deliver, so you need to go borrow them from someone who does have them.
Additionally, it's important to note that all people who borrow stock have sold it short. They may just be money lenders, making loans collateralized by stock.