They follow the same rules as casters with class levels. NPCs have as much or as little spare XP as the DM decides they have.
D&D is a roleplaying game, not a simulation. The rules are an abstraction for the players to interact with the game, not how the game world actually works (unless you're playing in a OOTS-like campaign at least).And for that matter, do NPCs in general have rules governing magic item creation and where they get the XP for that? I can't imagine every enchanter out there just happens to also be a mercenary adventurer going out and raiding dungeons all the time to keep up their business; and if they actually all are, I shudder to think of the ecological consequences for the monster species they must hunt.
Joe Commoner can't become level 8 in a few weeks by going out to kill a CR 1 animal every day (a PC could) and NPC crafters don't need to go murderhoboing to collect the souls of their enemies as crafting fuel. Not by default at least.