The adaptation of populations to changing conditions may be affected by interactions between individuals. For example, when cooperative interactions increase fecundity, they may allow populations to maintain high densities and thus keep track of moving environmental optima. Simultaneously, changes in population density alter the marginal benefits of cooperative investments, creating a feedback loop between population dynamics and the evolution of cooperation. Here we model how the evolution of cooperation interacts with adaptation to changing environments. We hypothesize that environmental change lowers population size and thus promotes the evolution of cooperation, and that this, in turn, helps the population keep up with the moving optimum. However, we find that the evolution of cooperation can have qualitatively different effects, depending on which fitness component is reduced by the costs of cooperation. If the costs decrease fecundity, cooperation indeed speeds adaptation by increasing population density; if, in contrast, the costs decrease viability, cooperation may instead slow adaptation by lowering the effective population size, leading to evolutionary suicide. Thus, cooperation can either promote or—counterintuitively—hinder adaptation to a changing environment. Finally, we show that our model can also be generalized to other social interactions by discussing the evolution of competition during environmental change.