When you get a corporate bond, you become a creditor for the company.
The company wants to use your cash to buy equipment or other resources. The company promises to pay you a set interest rate for that privilege.
They are riskier investments and there’s always a concern for credit risk.
Being a bond holder means technically you jump ahead of stockholders should the company default.