If you purchased from Microsoft, and it was a Windows 10 license, on the new computer, go to Settings > System > Activation, run the troubleshooter, choose the hardware change option. When it asks you where it is installed on right now, you should choose the old device name. Then click on Activate button. And on the next screen when it asks you where to transfer it to, choose your new device name. See if that works.
However, if the license was originally a Windows 7 or 8 license that is later upgraded to 10, you cannot install Windows 11, it has to be Windows 10 only.