Understanding human institutions, animal cultures and other social systems requires flexible formalisms that describe how their members change them from within. We introduce a framework for modelling how agents change the games they participate in. We contrast this between-game 'institutional evolution' with the more familiar within-game 'behavioural evolution'. We model institutional change by following small numbers of persistent agents as they select and play a changing series of games. Starting from an initial game, a group of agents trace trajectories through game space by navigating to increasingly preferable games until they converge on 'attractor' games. Agents use their 'institutional preferences' for game features (such as stability, fairness and efficiency) to choose between neighbouring games. We use this framework to pose a pressing question: what kinds of games does institutional evolution select for; what is in the attractors? After computing institutional change trajectories over the two-player space, we find that attractors have disproportionately fair outcomes, even though the agents who produce them are strictly self-interested and indifferent to fairness. This seems to occur because game fairness co-occurs with the self-serving features these agents do actually prefer. We thus present institutional evolution as a mechanism for encouraging the spontaneous emergence of cooperation among small groups of inherently selfish agents, without space, reputation, repetition, or other more familiar mechanisms. Game space trajectories provide a flexible, testable formalism for modelling the interdependencies of behavioural and institutional evolutionary processes, as well as a mechanism for the evolution of cooperation.