why do they go public and sell stocks in their company

To raise capital (money).