We present a new chemodynamical code –ramses-ch– for use in simulating the self-consistent evolution of chemical and hydrodynamical properties of galaxies within a fully cosmological framework. We build upon the adaptive mesh refinement code ramses, which includes a treatment of self-gravity, hydrodynamics, star formation, radiative cooling and supernova feedback, to trace the dominant isotopes of C, N, O, Ne, Mg, Si and Fe. We include the contribution of Type Ia and Type II supernovae, in addition to low- and intermediate-mass asymptotic giant branch stars, relaxing the instantaneous recycling approximation. The new chemical evolution modules are highly flexible and portable, lending themselves to ready exploration of variations in the underpinning stellar and nuclear physics. We apply ramses-ch to the cosmological simulation of a typical L★ galaxy, demonstrating the successful recovery of the basic empirical constraints regarding [α/Fe]–[Fe/H] and Type Ia/II supernova rates.