The star formation, and consequently the evolutionary path of galaxies, is shaped by the gas content within the interstellar medium (ISM), which directly fuels the formation of stars. The ISM is influenced by a galaxy’s interactions with its surrounding circumgalactic medium (CGM) and the larger intergalactic medium (IGM). These components act as reservoirs and pathways for gas flows that regulate star formation and redistribute metals, shaping the so-called baryon cycle. I will discuss recent observational studies of this intricate galactic ecosystem, with a focus on the brightest cluster galaxy (BCG) in the cool-core cluster MACS1931-26. By tracing both cold (10-100 K) and warm (100-1000 K) H₂ gas using multiple tracers, we find that shocks and AGN-driven X-ray emission contribute to heating the molecular gas, revealing the complex feedback mechanisms at play. These results provide crucial insights into how galaxies sustain and regulate their star-forming fuel, highlighting the dynamic role of the CGM and IGM in shaping galaxy evolution.