The term originated with paper-and-dice role playing games, specifically the Dungeons & Dragons ancestor Chainmail. It refers to characters that are operated by the game engine or game master. These characters are generally less "rounded"—they do not have much Character Development, unless the dev team or gamemaster is exceptionally skilled.
In the extreme case, an NPC's entire existence will consist of walking back and forth (typically right where you don't want them to be in 2D games) and saying the same line of dialogue over and over again. (That is if they have the honor of being able to move; sometimes they just stare in one direction until you talk to them.) Though, if necessary, they can move with such speed and access that the player can only dream about. A privileged few may be made into quest-givers, temporarily giving them some small worth in the eyes of passing protagonists. A sufficiently cool NPC may even be Promoted to Unlockable.
The term is sometimes, in tabletop-derived computer games, used to refer to any non-hostile character that the player did not create directly, even if the player has near-complete control of them for gameplay purposes. In fact, it has even been used to specifically refer to those characters that can join the player's group and be controlled by them but are not the one specific character representing the player.
The counterpart, of course, is the Player Character.