Rapid progress in precision nanoscale and atomic-scale design over the past decades has driven transformative advances in controlling the generation and propagation of light, giving rise to the field of nanophotonics. While nanophotonics has traditionally focused on manipulating electromagnetic waves across the microwave to visible spectrum, recent developments have extended its impact into ultrashort-wavelength regimes, including X-rays and free-electron wavepackets. In this review, we highlight the impact and potential of nanophotonics in this relatively unexplored yet technologically disruptive domain, demonstrating how nanoscale and atomic-scale design enable unprecedented technologies in quantum science related to X-rays and free electrons. We place particular emphasis on quantum phenomena arising from electron–photon entanglement in free-electron radiation, including quantum recoil effects, enhancing and controlling X-ray generation through free-electron waveshaping, and the potential for quantum light generation driven by free electrons. The nanoscale control of material structures and light enables manipulation of free-electron-driven X-rays and electron wavepackets at the wavelength scale, revealing quantum features and offering potential pathways for developing novel, compact light and electron sources. We also review high-harmonic generation (HHG), which arises from quasi-free electrons, as a source of extreme ultraviolet and X-rays, including nano-optics-enhanced and quantum light-driven HHG. The review then explores X-ray waveguide nanophotonics, covering waveguide fundamentals, fabrication, mode structures, and applications in coherent imaging and emitter interactions. Finally, we highlight emerging applications of nanophotonics-enabled X-rays and free electrons, including quantum X-ray imaging, X-ray detection, and quantum information technologies, where free electrons are explored as quantum probes, information carriers, and quantum light sources. Our review underscores the unique opportunities within the X-ray and free-electron regimes and the enormous potential of quantum nanophotonics to revolutionize these fields through tailored interactions between photons, free electrons, and nanomaterials.