Your question can be rephrased as: 'why finance a company with equity, instead of with debt?'
Before answering, let's briefly define the terms:
Debt Financing is generally simplistic. If I loan a company money, it likely has a legal obligation to pay me a specific % of interest each year, with full repayment of my principal at a set point in the future. I will only lose my investment if the company goes bankrupt and becomes unable to pay all of its debtors.
So, my risk here is relatively low, but my return is also fixed.
'Equity Financing' is another way of saying funding received through the sale of shares. Someone who buys those shares becomes a 'shareholder', AKA a partial owner. A 'share' typically provides a few benefits to the purchaser (note that different 'share classes' can have different rights, but these are the typically present ones; look up "common shares vs preferred shares" for some frequent differences in share rights):
(1) It likely gives the shareholder a certain right to dividends;
(2) It likely gives the shareholder a certain right to money when the company closes; and
(3) It likely gives the shareholder a certain voting right, to elect the Board.
In short, if I buy a share, it doesn't give me as sure-fire a return as loaning the company money. BUT, because points #1 & #2 are typically proportional to a company's future earnings, then if the company does quite well, I stand to earn more than if I just loaned the company money.
So the trade-off to the investor, is essentially 'lower risk' with debt vs 'higher reward' with equity.
For the company itself, the choice is actually quite similar - remembering that the company is already owned by shareholders, so what we're actually talking about with 'what is better for the company' is 'what is better for the current shareholders'?
For the company, every $ of debt financing used for operations, is a guaranteed interest payment they need to make. So the more debt used to finance operations, the riskier the company becomes. Every $ of equity financing does reduce dividends for previous shareholders, but that's at the benefit of having a less risky company. For example, if the company has a loss in the year and can't pay its debt, it might need to declare bankruptcy. But if it has a loss in the year with equity financing, it likely just means there won't be dividends that year.
To take it one step further, if a company has a significant amount of debt relative to its assets, investors will expect that they pay a high rate of interest anyway, to compensate them for investing in a company that has a higher possibility of going bankrupt. If a company has entirely too much debt, or is already risky to begin with, ultimately the only way to get financing will likely be to offer equity financing, so that investors taking on higher risk can get compensated with higher reward.