Climate change scenarios predict a doubling of the atmospheric CO2 concentration by the end of this century. Yet, how rising CO2 will affect the species composition of aquatic microbial communities is still largely an open question. In this study, we develop a resource competition model to investigate competition for dissolved inorganic carbon in dense algal blooms. The model predicts how dynamic changes in carbon chemistry, pH and light conditions during bloom development feed back on competing phytoplankton species. We test the model predictions in chemostat experiments with monocultures and mixtures of a toxic and non-toxic strain of the freshwater cyanobacterium Microcystis aeruginosa. The toxic strain was able to reduce dissolved CO2 to lower concentrations than the non-toxic strain, and became dominant in competition at low CO2 levels. Conversely, the non-toxic strain could grow at lower light levels, and became dominant in competition at high CO2 levels but low light availability. The model captured the observed reversal in competitive dominance, and was quantitatively in good agreement with the results of the competition experiments. To assess whether microcystins might have a role in this reversal of competitive dominance, we performed further competition experiments with the wild-type strain M. aeruginosa PCC 7806 and its mcyB mutant impaired in microcystin production. The microcystin-producing wild type had a strong selective advantage at low CO2 levels but not at high CO2 levels. Our results thus demonstrate both in theory and experiment that rising CO2 levels can alter the community composition and toxicity of harmful algal blooms.