Granular sludge intensifies the removal of nutrients from wastewater. Granules structured by extracellular polymeric substances (EPS) can be recovered as biomaterial. Links between microbial selection and EPS formation during granulation need to get uncovered. We inoculated anaerobic-aerobic sequencing batch reactors with either flocs or granules to study the relationships between microbial selection, bioaggregation, exopolymer formation, and EPS composition. Selection for slow-growing organisms like the model polyphosphate-accumulating organism "Candidatus Accumulibacter" (max. 83% vs. amplicon sequencing read counts) and glycogen-accumulating organism "Ca. Competibacter" (max. 45%) sustained granulation. Gel-forming exopolymers were produced as high as above 40% of the volatile solids of the biomass by stepwise increase of the organic loading rate (0.3 to 2.0 g CODAc d-1 LR-1). Confocal laser scanning microscopy, FT-IR spectroscopy, and HPAE-PAD chromatography revealed the complex and dynamic chemical compositions of the structural EPS in relation to microbial population shifts along reactor regimes. The analysis of 20 representative genomes of "Ca. Accumulibacter" and "Ca. Competibacter" recovered from public databases revealed their functional potential to produce EPS among other representative wastewater microorganisms. The more than 40 functional gene categories annotated highlight the complexity of EPS metabolic networks from monomers processing to assembly, export, and epimerizations. The combination of ecological engineering principles and systems microbiology will help unravel and direct the production of EPS from wastewater, valorizing residual granular sludge into beneficial biomaterials for the circular economy.