The process of evolutionary rescue, which allows a population to avoid extinction through adaptation, has been extensively studied. However, these studies have made strong assumptions, such as ignoring the effect of density on growth rate. It remains unclear how density dependence growth rate affects adaptation to altered environments. To evaluate how density dependence influences evolutionary rescue, we subjected diverse and bottlenecked populations of red flour beetle, Tribolium castaneum, to a new and challenging environment and let them evolve for six discrete generations in conditions of density dependence and density independence. Our results indicate that density dependence significantly increases the risk of extinction for both diverse and bottlenecked populations. In contrast, density-independent populations were able to adapt and grow rapidly, particularly those with high initial diversity. Population dynamics show that initial diversity partially balances the negative effects of density dependence, while bottlenecked populations neutralize the benefits of density independence. The bottlenecked populations evolving on density dependence had dynamics nearly as bad as those from control populations that were unable to adapt. At the end of the experiment, a reciprocal transplant experiment confirmed that all populations, except for the non-evolving control, had adapted to the challenging environment. The diverse populations showed a much higher level of adaptation than the bottlenecked populations. Interestingly, there was no clear and strong effect of density dependence that would make selection more effective overall. Taken together, these results emphasize the significance of accounting for density dependence when examining adaptation to altered environments. This is crucial for making practical and effective conservation decisions and management strategies for populations facing environmental changes that may lead to extinction.