You need to buy a Windows 7 DVD complete with licence & Product Key.
However, town & city computer stores no longer stock Windows 7 now, Microsoft took all the unsold discs back to force people to buy Windows 8 instead.
However, you can still buy fully legal & genuine Windows 7 on Amazon so try there.
You will have to remove Windows XP first, you can't upgrade XP to Windows 7, it has to be a clean install.
But before you rush headlong into buying Windows 7 you first need to check that you can get Windows 7 drivers for your PC model, so check on the PC maker's website first.
If it's a custom-built PC, check the motherboard maker's website instead.