Saline aquifer, a geological body, is widely distributed in the world and has high CO2 sequestration potential. Due to the large differences in viscosity and density between the CO2 and brine and the micro-heterogeneity of the saline aquifer, CO2 override, and viscous fingering may occur in strata, resulting in low CO2 sequestration efficiency. Following the concept of green chemistry, this study formulated CO2 foam using biopolysaccharides and a green surfactant alkyl polyglycosides (APG), to enhance the CO2 sequestration efficiency in saline aquifers. The ability of three biopolysaccharides (diutan gum, welan gum and xanthan gum) to stabilize CO2 foam was explored. According to the foam drainage activation energy and the Ostwald ripening rate, the CO2 foam with diutan gum as the stabilizer and APG as the foaming agent exhibited the favorable performance. The mechanism of diutan gum stabilizing CO2 foam was analyzed through studies on intermolecular interactions, interfacial properties, rheology, and micromorphology studies. We then investigated the effects of foam quality and flow rate on the CO2 foam rheology in sandstone cores by analyzing the changes in CO2 saturation, the matching relationship between bubble diameters under different conditions and sandstone core pore size, and the variation in foam rheology was explained. Furthermore, the ability of CO2 foam to enhance CO2 sequestration was explored in saline aquifers using core-nuclear magnetic resonance techniques. CO2 foam largely reduces the water saturation of macropores and establishes high-seepage resistance to facilitate CO2 foam diversion to the meso- and micropores. This fully leverages the space in these pores to store CO2 and greatly improves CO2 sequestration in saline aquifers.