In this study, sustainable nanoporous carbon materials that are efficient, renewable, cost-effective and adaptable were developed. These microporous feature carbon adsorbents were synthesized utilizing a straightforward and efficient method. Plum stones are residual fruit materials that offer a financially feasible and sustainable carbon source with exceptional porosity and desirable elemental composition. The plum stones underwent carbonization and were subsequently chemically modified with polyaniline nanofibers and then subjected to chemical activation using different activating agents. This yielded sustainable nanoporous carbon with a high degree of porosity, in conjunction with doping with precious high electron density elements such as O, N and S. The sustainable nanoporous carbons that have been developed exhibits exceptional microporosity, with BET-SSA of 1705 m2 g−1 and a pore volume of 0.726 cm3 g−1, besides, the dominance of ultramicropores of 0.6 nm size. This in addition to convenient doping of oxygen, nitrogen and sulfur elements which are crucial for H2 uptake. The developed nanoporous carbon demonstrated highly promising capabilities for storing H2 molecules at cryogenic and ambient temperatures. The sustainable adsorbent achieved hydrogen storage capacities of 4.63 and 0.45 wt% at 77, 296 K, and a pressure of 40 and 80 bar, respectively. This H2 storage capacity at RT is often regarded as one of the highest reported in the literature for nanoporous adsorbents. Moreover, study investigated the separation selectivity of developed adsorbents for CO2/H2 based on uptake ratio at 30 bar and RT. The results demonstrated a significant separation selectivity reaching a value of 382.5 for the CO2/H2, which is regarded as one of the most elevated values documented in the existing literature for nanoporous carbon materials. Thus, the presented sustainable nanoporous materials have shown great promise for hydrogen storage, pre-combustion CO2 capture and H2 purification applications at ambient temperature.