Room-temperature sodium–sulfur batteries (RT-NaSBs) are the evolving candidates for large-scale stationary storage because of their major benefits including double-electron redox process and the natural abundance of sodium and sulfur resources. However, their practical applications have been hampered by the poor cycling stability due to the shuttle effect. This work aims at understanding the role of heteroatom-functionalized nanoporous graphene (NPG) in preventing the shuttle effect. The density functional theory method was used to unravel important properties associated with polysulfide–NPG interactions, including binding energy, electronic density of states, charge transfer mechanism, and dissociative energy barriers of the polysulfides. The findings reveal that oxygen- and nitrogen-functionalized NPG can effectively present the shuttle effect by chemically binding to sodium polysulfides (Na2Sn) with a binding energy stronger than that between Na2Sn and the common electrolyte solvents. The chemical adsorption of Na2Sn on the functionalized NPG causes a semiconductor-to-metal transition, benefiting the electrical conductivity. Moreover, the functionalized NPG lowers the Na2S dissociation energy to substantially form NaS and Na, which serves as a catalyst for enhancing the redox reactions between Na and S.