The largest ever primate and one of the largest of the southeast Asian megafauna, Gigantopithecus blacki1, persisted in China from about 2.0 million years until the late middle Pleistocene when it became extinct2-4. Its demise is enigmatic considering that it was one of the few Asian great apes to go extinct in the last 2.6 million years, whereas others, including orangutan, survived until the present5. The cause of the disappearance of G. blacki remains unresolved but could shed light on primate resilience and the fate of megafauna in this region6. Here we applied three multidisciplinary analyses-timing, past environments and behaviour-to 22 caves in southern China. We used 157 radiometric ages from six dating techniques to establish a timeline for the demise of G. blacki. We show that from 2.3 million years ago the environment was a mosaic of forests and grasses, providing ideal conditions for thriving G. blacki populations. However, just before and during the extinction window between 295,000 and 215,000 years ago there was enhanced environmental variability from increased seasonality, which caused changes in plant communities and an increase in open forest environments. Although its close relative Pongo weidenreichi managed to adapt its dietary preferences and behaviour to this variability, G. blacki showed signs of chronic stress and dwindling populations. Ultimately its struggle to adapt led to the extinction of the greatest primate to ever inhabit the Earth.