Gaia gathers data about the composition of far-off stars using a technique called spectroscopy, with its instrument called the Radial Velocity Spectrometer (via ESA). Spectroscopy works by breaking down light into different wavelengths, like the rainbow of colors you see when light passes through a prism. By breaking down light in this way, sensors on the spacecraft can detect which wavelengths of light are absent. These correspond to certain elements, which absorb light at particular wavelengths. For this reason, you can tell what a distant star is composed of by looking at the light it gives off (via Gaia).
This is what has allowed Gaia to create a colored-coded representation of the stars in the Milky Way, showing what percentage of heavy elements each star contains. This information — which astronomers call a star’s metallicity — is useful to know because younger stars tend to have higher metallicity. That’s because older stars are made up of simpler elements like hydrogen and helium, and they create heavier elements by nuclear fusion. When these stars die, they release these heavier elements which then become newer, younger stars.
So by looking at which regions have stars with higher or lower metallicity, researchers can see how our galaxy has evolved through time. “Therefore, a star’s chemical composition is a bit like its DNA, giving us crucial information about its origin,” ESA writes. “With Gaia, we see that some stars in our galaxy are made of primordial material, while others like our Sun are made of matter enriched by previous generations of stars. Stars closer to the center and plane of our galaxy are richer in metals than stars at larger distances.”