I don't even know how I got Windows 11 at this point 900 reinstalls later. I build all my own pcs. I must have paid for a key at some point, potentially.
You could have bought Windows 7 or 8 then upgraded (free) to 10 then 11. If you ever logged in with a Microsoft account for a user, then the entitlement is tied to your Microsoft account.