Large brains and behavioural innovation are positively correlated, species-specific traits, associated with the behavioural flexibility animals need for adapting to seasonal and unpredictable habitats. Similar ecological challenges would have been important drivers throughout human evolution. However, studies examining the influence of environmental variability on within-species behavioural diversity are lacking despite the critical assumption that population diversification precedes genetic divergence and speciation. Here, using a dataset of 144 wild chimpanzee (Pan troglodytes) communities, we show that chimpanzees exhibit greater behavioural diversity in environments with more variability - in both recent and historical timescales. Notably, distance from Pleistocene forest refugia is associated with the presence of a larger number of behavioural traits, including both tool and non-tool use behaviours. Since more than half of the behaviours investigated are also likely to be cultural, we suggest that environmental variability was a critical evolutionary force promoting the behavioural, as well as cultural diversification of great apes.