From UEFI spec 2.8, GPT partition entry array definition (5.3.3), I understand that Unique Partition GUID is to "uniquely identify every partition that will ever be created". And the language seemingly implies there can be a pool of GUIDs or some default GUID generator. Then where does this pool/generator usually reside? (tool lib like fdisk? media firmware? I don't think it's in BIOS or kernel from what I read.)
If you are interested in details, RFC 4122 describes UUIDs in more details and also includes description of algorithms to create them. (UUID and GUID are more or less synonyms, there are some differences, if you are interested in details, I recommend this answer on stackoverflow).