There are several possible sources for the interest:
Your deposited crypto is lent to margin and short traders. A part of the loan interest the traders pay is then payed to you.
If you deposited stablecoins, they are usually lent to someone who takes a loan. A part of the loan interest the borrowers pay is then payed to you.
In other cases interest providers like new exchanges or projects offer interest to attract new users.
Finally the interest is earned by using your crypto for staking. Staked crypto secures a blockchain and earns interest in return.