Based on the extra details edited in, I want to modify my answer:
he wants me to temporarily hold his money. he has issues with his wife
and he did not want to have any extra money on his personal account.
This is dangerous. Depending on what is going on you could face legal problems, if the hiding of funds is related to a divorce, separation, or child support issue.
In the strict sense it isn't a gift, or a loan. But you could find yourself dragged into a legal issue far beyond taxes.
Because the transfer was done electronically, then if the court requires a review of their banking records they will want to know why the transfer was done. They will want the money back, unless there was a legitimate reason. You don't want to lie about the reason.
I would suggest you transfer it back, and let them deal with it on their own.
Previous answer: which only applied if it was a gift, but it isn't a gift based on the new information.
Lets assume it was a gift:
You don't pay any tax. You don't even have to report it to the IRS. The relative may have to report this.
If they gave you the entire $31,000 in 2021, then $15,000 of it is tax free. They will have to submit a tax form to count the excess $16,000 against their lifetime exclusion.
If they gave you $15,000 one year (2020) and $16,000 in 2021, then only $1,000 would be counted against their lifetime exclusion. Same if the order was switched.
If they are married or you are married they could give $30,000 in one year without having to count against their lifetime exclusion. But if they are married and you are married, then they could give you $60,000 in one year.
Now if it is a loan, then there should be be interest paid on the loan, which they would count as income. Though the initial transfer wouldn't have any gift tax impacts.
If it is pay for some service, then you would have to report it on your income tax forms.
There is another way that a gift/loan can be important. If the money is given to you and you are about to get a home mortgage the lender will want to know if it is gift or a loan. Your relative will be asked to document the gift/loan. The lender wants to know because loans have to be paid back, and they want to know all your obligations.
While you did say they transferred the money, I will add one more example. If they gave it to you in cash, then your bank may report the large cash transaction when you deposit it. This is part of the anti-money-laundering laws.