The near-Earth carbonaceous asteroid (162173) Ryugu is expected to contain volatile chemical species that could provide information on the origin of Earth’s volatiles. Samples of Ryugu were retrieved by the Hayabusa2 spacecraft. We measure noble gas and nitrogen isotopes in Ryugu samples, finding they are dominated by pre-solar and primordial components, incorporated during Solar System formation. Noble gas concentrations are higher than those in Ivuna-type carbonaceous (CI) chondrite meteorites. Several host phases of isotopically distinct nitrogen have heterogeneous abundances between the samples. Our measurements support a close relationship between Ryugu and CI chondrites. Noble gases produced by galactic cosmic rays, indicating ~5 Myr exposure, and from implanted solar wind, record the recent irradiation history of Ryugu after it migrated to its current orbit.