Nothing will happen in law,all that will happen is that you will be 5000€ lighter in your bank account.
It's an old scam.
You give your friend the money,and then (surprise,surpsrise) the money that should have been deposited by him is withdrawn/not available,or some other problem.
Result,he gets the money from your account,and you are 5000€ worse off.
Don't touch it with a bargepole,not even if this money "appears" to be credited to your account.
Who (or what) is paying the money into your account,and why cannot he pay it to his account,and if he doesn't have a bank account why doesn't he?
It stinks!