During cosmic times, nuclear reactions re-arrange the nucleons that were left behind from the big bang (in the form of isotopes of hydrogen and helium, and traces of lithium, beryllium, and boron) to other isotopes and elements as we find them today (see graph). The driver is a conversion of nuclear binding energy to exothermic energy, favoring nuclei with more binding of their nucleons - these are then lighter as their original components by the binding energy. The most tightly-bound nucleus from symmetric matter of neutrons and protons is Ni. The release of nuclear binding energy is what allows stars to shine for up to billions of years, and may disrupt stars in stellar explosions in case of violent reactions (such as C+ C fusion for thermonuclear supernova explosions). As matter is processed as such within stars and stellar explosions, some of the products are ejected from the nuclear-reaction site and end up in interstellar gas. Then, it may form new stars, and be processed further through nuclear reactions, in a cycle of matter. This results in compositional evolution of cosmic gas in and between stars and galaxies, enriching such gas with heavier elements. Nuclear astrophysics is the science to describe and understand the nuclear and astrophysical processes within such cosmic and galactic chemical evolution, linking it to knowledge from nuclear physics and astrophysics. Measurements are used to test our understanding: Astronomical constraints are obtained from stellar and interstellar abundance data of elements and isotopes, and other multi-messenger astronomical measurements of the cosmic object phenomena help to understand and model these. Nuclear properties can be obtained from terrestrial nuclear laboratories such as accelerators with their experiments. Theory and simulations are needed to understand and complement such data, providing models for nuclear reaction rates under the variety of cosmic conditions, and for the structure and dynamics of cosmic objects.