The behaviour they use to follow depends on the genre of game, I can't imagine what it looks like.
To choose an NPC you could give each one a variable value like 1,2,3... and a global variable number which is the NPC that is following you.
When you interact you set the global variable to the NPC number. Then for following, you can say if NPC.variable = global variable then follow, Else don't follow.