In short: a guarantor is a person who commits to pay someone else's loan if the borrower does not — a personal responsibility for another person's debt, not a formality.
Simply put: the lender asks for a guarantor to have a second source of payment. If the borrower stops paying, the lender can claim the amount from the guarantor. In many countries the guarantee is also recorded in the guarantor's credit history.
Example: Ivan becomes a guarantor for a friend's €8,000 loan. Two years later the friend stops paying with €5,000 outstanding. The lender turns to Ivan.
Watch out: before you sign, ask about the amount, term and interest, and answer honestly: could I pay if I had to?
The EU rule: the EU/OECD-INFE framework for adults (2022) asks people to understand the social and financial consequences of being a guarantor; the details of guarantees are set by national law.
Example: Bulgaria — guarantors and co-debtors are recorded in the BNB Central Credit Register; when a borrower is in difficulty, the lender must also contact the guarantor (Consumer Credit Act, Article 32a(2)); in personal insolvency, guarantors' obligations are not discharged.
Check in your country — What exactly does a guarantor sign, and is it recorded in the credit register? Ask your consumer protection authority.
Source: Pecuvo Module 22, Chapter 7, and Module 23, Chapter 7; BNB — Central Credit Register: https://www.bnb.bg/RegistersAndServices/RSCreditRegister/index.htm