I've already formatted the disk and reinstalled catalina & big sur. The problem is not solved. Thanks for your advice.
Any other ideas?
At that point, since it's so new, I would call Apple support. You're well inside the standard warranty window, so even without applecare, they will totally take care of you.
Explain the issue, and that you want the system looked at, and they will guide you as to the next steps.
I honestly think you should ask for an exchange with another system - which I think they would entertain. If it were me, I would be very emphatic, and explain in no uncertain terms that the system is performing WAAAAY below any reasonable expectations, and that the only fair and warranted solution is a full exchange with a property working replacement iMac.
They'll first probably have you go through a number of time consuming 'attempts' at a solution. But if, as I suspect, they don't solve the problem, then you need to tell them what you have is clearly a lemon and you need a replacement system that isn't broken.