Aerobic granular sludge represents an interesting approach for simultaneous organic matter and nitrogen removal in wastewater treatment plants. However, the information about microbial communities in aerobic granular systems dealing with industrial wastewater like pig slurry is limited. Herein, bacterial diversity and dynamics were assessed in a pilot scale plant using aerobic granular sludge for organic matter and nitrogen elimination from swine slurry during more than 300 days. Results indicated that bacterial composition evolved throughout the operational period from flocculent activated sludge, used as inoculum, to mature aerobic granules. Bacterial diversity increased at the beginning of the granulation process and then declined due to the application of transient organic matter and nitrogen loads. The operational conditions of the pilot plant and the degree of granulation determined the microbial community of the aerobic granules. Brachymonas, Zoogloea and Thauera were attributed with structural function as they are able to produce extracellular polymeric substances to maintain the granular structure. Nitrogen removal was justified by partial nitrification (Nitrosomonas) and denitrification (Thauera and Zoogloea), while Comamonas was identified as the main organic matter oxidizing bacteria. Overall, clear links between bacterial dynamics and composition with process performance were found and will help to predict their biological functions in wastewater ecosystems improving the future control of the process.