Primarily interested in pen-and-paper (or really, just the general concept of RPGs) here, as I'm already familiar with the the history of electronic RPGs, but insight into RPGs on computers/consoles is also welcome!
For quite a long time, there have been war-game simulations, where each individual control an army. Gary Gygax, in his own words the co-creator of Dungeons and Dragons, long before he created D&D created a game called Chainmail - a Historical Fantasy Wargame where competitors controlled armies of swordsmen, pikemen, cavalry, archers, etc.
Over time, this wargaming simulation percolated in the minds of Dave Arneson - the other co-creator of Dungeons and Dragons - and Dave Wesley, who Arneson credits with coming up with the idea of controlling individuals instead of armies. Arneson then developed a setting called Blackmoor, where players controlled individual heroes that went on fantastic adventures, resolving combat using the Chainmail rules.
Over time, Blackmoor became more elaborate, developing classes, levels, and many other staples of the genre. Arneson contacted Gygax, and they began working together on a concept that they called "The Fantasy Game", which was, in essence, a rough and unpolished Dungeons and Dragons. This "0th Edition" is, when viewed through modern eyes... pretty rough actually. It's not a very crisp game in terms of rules or play, but it marked an important turning point as the first game to define Role Playing Games as we now think of them.
To give a slightly crisper answer to your question -- Dungeons and Dragons and its primordial forms were the first Pen and Paper Role Playing Games in the way we think of them now. It took hints and influences from wargaming - a modern example of which would be Warhammer 40K - as well as fantasy literature like Tolkien and pulp fantasy like Jack Vance, but the first Pen and Paper RPG that we know of was Arneson's Blackmoor, which went on to become Dungeons and Dragons.
To give a much crisper answer -- Yes, the D&D family is the first tabletop we know of.
Without rehashing the rest of the excellent replies in this thread, Jon Peterson's 2012 book "Playing at the World" is a very thorough history of D&D that specifically traces the history of all its elements from early chess games through German kriegspiel to American wargaming. He works exclusively through primary sources and carefully articulates when something he says borders on speculative. You can get a good idea of his approach from his blog, but I would highly recommend his book as a comprehensive and careful history of D&D as the first roleplaying game while also identifying all of its antecedents.