Credit risk refers to the risk that a borrower or issuer of a security may not repay the principal of the loan or interest associated with it to the lender.
Credit risks are computed based on factors that impact future cash flows of the borrower or issuer since that defines their ability to repay.
Rating agencies analyse borrowers or issuers in an effort to measure the credit risk of the particular debt security and publish the results as ratings for lenders to read and compare.
If a security has a low rating (BBB or lower), the borrower or issuer has a high risk of default; if it has a high rating (AAA is the highest), it is considered to be a safe investment.
If there is a higher level of perceived credit risk, investors and lenders demand a higher rate of interest for their capital.