Fully functional XP images that you can sandbox inside a virtual machine exist in many places, including Microsoft's own Windows XP Mode for Windows 7. Most people won't actually, hopefully need this tool. Another tool, WindowsXPKg, deliciously hosted on the GitHub servers Microsoft owns, can generate keys but requires an external server that, as of this posting, no longer seems to be operating. But they were typically software hacks or brute-force decryption tools that, while locally accepted, would not validate with Microsoft (for what that's worth now).
Tools for generating keys that Windows XP would accept existed long before this entirely offline little program-lots and lots of them. It is, seemingly, the same key Microsoft would provide for your computer. It's persistent across system wipes and re-installs. Xp_activate32.exe, a 18,432-byte program (hash listed on tinyapps' blog post), takes the code generated by Windows XP's phone activation option and processes it into a proper activation key (Confirmation ID), entirely offline.