The "iterated prisoner's dilemma" is the most widely used model for the evolution of cooperation in biological societies. Here we show that a heterogeneous population consisting of simple strategies, whose behavior is totally specified by the outcome of the previous round, can lead to persistent periodic or highly irregular (chaotic) oscillations in the frequencies of the strategies and the overall level of cooperation. The levels of cooperation jump up and down in an apparently unpredictable fashion. Small recurrent and simultaneous invasion attempts (caused by mutation) can change the evolutionary dynamics from converging to an evolutionarily stable strategy to periodic oscillations and chaos. Evolution can be twisted away from defection, toward cooperation. Adding "generous tit-for-tat" greatly increases the overall level of cooperation and can lead to long periods of steady cooperation. Since May's paper [May, R. M. (1976) Nature (London) 261, 459-467], "simple mathematical models with very complicated dynamics" have been found in many biological applications, but here we provide an example of a biologically relevant evolutionary game whose dynamics display deterministic chaos. The simulations bear some resemblance to the irregular cycles displayed by the frequencies of host genotypes and specialized parasites in evolutionary "arms races" [Hamilton, W. D., Axelrod, R. & Tanese, R. (1990) Proc. Natl. Acad. Sci. USA 87, 3566-3573; Seger, J. (1988) Philos. Trans. R. Soc. London B 319, 541-555].