We present a model for the Universe in which quantum anomalies are argued to play an important dual role: they are responsible for generating matter-antimatter asymmetry in the cosmos, but also provide time-dependent contributions to the vacuum energy density of ``running-vacuum'' type, which drive the Universe's evolution. According to this scenario, during the inflationary phase of a string-inspired Universe, and its subsequent exit, the existence of primordial gravitational waves induces gravitational anomalies, which couple to the [Kalb-Ramond (KR)] axion field emerging from the antisymmetric tensor field of the massless gravitational multiplet of the string. Such anomalous $CP$-violating interactions have two important effects. First, they lead to contributions to the vacuum energy density of the form appearing in the ``running vacuum model'' (RVM) framework, which are proportional to both, the square and the fourth power of the effective Hubble parameter, ${H}^{2}$ and ${H}^{4}$ respectively. The ${H}^{4}$ terms may lead to inflation, in a dynamical scenario whereby the role of the inflaton is played by the effective scalar-field (``vacuumon'') representation of the RVM. Second, there is an undiluted KR axion at the end of inflation, which plays an important role in generating matter-antimatter asymmetry in the cosmos, through baryogenesis via leptogenesis in models involving heavy right-handed neutrinos. As the Universe exits inflation and enters a radiation-dominated era, the generation of chiral fermionic matter is responsible for the cancellation of gravitational anomalies, thus restoring diffeomorphism invariance for the matter/radiation (quantum) theory, as required for consistency. Chiral U(1) anomalies may remain uncompensated, though, during matter/radiation dominance, providing RVM-like ${H}^{2}$ and ${H}^{4}$ contributions to the Universe energy density. Finally, in the current era, when the Universe enters a de Sitter phase again, and matter is no longer dominant, gravitational anomalies resurface, leading to RVM-like ${H}^{2}$ contributions to the vacuum energy density, which are however much more suppressed, as compared to their counterparts during inflation, due to the smallness of the present era's Hubble parameter ${H}_{0}$. In turn, this feature endows the observed dark energy with a dynamical character that follows the RVM pattern, a fact which has been shown to improve the global fits to the current cosmological observations as compared to the concordance $\mathrm{\ensuremath{\Lambda}}\mathrm{CDM}$ model with its rigid cosmological constant, $\mathrm{\ensuremath{\Lambda}}>0$. Our model favors axionic dark matter, the source of which can be the KR axion. The uncompensated chiral anomalies in late epochs of the Universe are argued to play an important role in this, in the context of cosmological models characterized by the presence of large-scale cosmic magnetic fields at late eras.