Credit spreads represent the extra yield investors receive for holding bonds issued by corporates, that typically have higher default risk than government bonds. However, they do not compensate for default risk alone.
In fact, it is well established in academic literature and market experience that default risk is not the major driver of investment grade (IG) credit returns and historical data shows that IG credit spreads consistently over-compensate relative to actual default losses.
However, this excess compensation is not free money. Rather it can be thought of as a credit risk premium that compensates investors for the other risks, beyond default risk, that they are exposed to. These other risks are often more important drivers of credit spreads than default risk.