It depends on the type of NPC. All NPCs gain XP by ground travel, but builders also gain XP from building, brawlers from brawling, etc. In short, those with implemented functions gain XP from them just as PCs do. Then you can level their skills through the Edit Skills option beside the NPC in your inventory.