Celebrim
Legend
Much as I'd love to have seen SF be the first inspiration, I can't; fantasy was more popular.
There has never been a single hard sci fi property that ever really found a place in popular culture. And I don't mean by that a particularly strict definition of hard science fiction, but merely something other than space wizards. If you look at all the popular science fiction to have impacted popular culture they all feature magic with the color of science and rely heavily on fantasy tropes. Star Wars is of course space wizards and knights explicitly in a fairy tale setting. Star Trek, despite some occasional forays into something that might be considered science fiction, features Greek gods, space elves with magical powers, space orcs, and any number of demiurges whose divine powers are explained away with a handwave of gnostic super science. Babylon 5 for all its nods to zero-g and science fiction themes features as it main story an alliance between humans and space elves on the eve of a war between angels and demons and subplots about clerics powered by faith and space wizards. Even 2001: A Space Odessey ultimately is more about its mythical super-advanced godlike beings who work unexplained magic than any sort of story which - as Heinlein put it - "would cease to exist if the science was removed". Most of what passes for "Science Fiction" in popular culture is reframing of ancient myth into a visual framework that is plausible to the modern audience and allows them to believe in fairies, demons, magic, and so forth just by changing the clothes that they wear.
But even if we limit the exploration to sub-genres of fantasy other than the "vaguely medieval inspired by the first birth of Northern European literature and/or it's leading modern voice/advocate/translator JRR Tolkien" I still don't believe that there is anything like the interest that we have for ahistorical anachronistic period pieces. Superhero games have been around since an early point but never caught on. Early experiments in Super Spy games and Western games mostly have shown that those genres were products of their time period and only fell off in popularity as time passed. The only genre that has ever been remotely as successful as fantasy medieval is fantasy horror, which brought us Call of Cthulhu, Vampire the Masquerade, and Deadlands. Two of those three are the only non-D&D inspired games that have ever contested with D&D for the #1 spot in tabletop RPGs, and CoC is I think the clear #2 tabletop RPG after D&D.
I firmly am opposed to the idea that we the primary tropes of D&D play like hit points, classes, levels, and vaguely medieval fantasy are not accidental artifacts of the fact that D&D got their first and set expectation about what an RPG would be like, but rather that they were highly effective low hanging fruits that became baked into D&D because no alternatives to them satisfied as many players. History is filled of examples where the first thing to market was quickly superseded by the second thing to market. The Wright brothers may have invented controlled flight, but they didn't become dominate forces in the aircraft industry. Beta was superseded by VHS, and the 8-track died. D&D didn't hang around because it was first, but because it got so much right and that includes choosing the genre that the is easiest to game in and which the majority of people find the most satisfying - heroic fantasy.