A CPU/RAM upgrade normally does not require a new Windows licence. Your activation may have been lost during the Windows 11 installation, or the wrong edition was installed.
Go to Settings > System > Activation > Troubleshoot, select “I changed hardware on this device recently,” sign in with the Microsoft account previously linked to Windows, choose this PC, then select Activate. See: https://support.microsoft.com/en-us/windows/activation/reactivating-windows-after-a-hardware-change
Also confirm that the installed edition matches your old licence—for example, Windows Home cannot activate Windows Pro.