The term "NPC" comes from tabletop role-playing games. In tabletop RPGs, one player is designated as a kind of referee (often called the "Game Master" generically, or "GM" for short, though many systems have their own names for this role). The GM's purpose is to direct events within the game world: in this sense, his or her role is not unlike that of the computer in a video game.
All of the other players (who are often just called "Players", even though technically the GM is a kind of player too; for this reason I will capitalize "Player" to refer specifically to non-GM players) control one or more characters in the game. These are called "Player Characters," or "PCs". Any character that isn't controlled by a Player -townsfolk, enemies, historical figures, allies of the PCs, and so on- falls under the GM's control, and these are called "Non-Player Characters." This last term is what "NPC" stands for.
Video games and bots blur the lines a little bit, because both NPCs and bots are AI-controlled in this context. The big difference comes back down to the question of whether the AI is acting as a Player, or as the GM: a bot plays the game, while an NPC presents the game (or some facet of it).
If you really want to blur the lines, consider fighting games, where a Player could choose to play as almost any of the characters (or sometimes any of them, even the boss). In this case, a given character might take on any of the roles: a PC when being controlled by a human, an NPC when being fought in a single-player campaign, or a bot when being fought in practice rounds or deathmatches. Thanks to mirror matches, it's even possible for a character to be in multiple roles at once.