Until now, most brain studies have focused on small numbers of neurons that interact in limited circuits, allowing analysis of individual computations or steps of neural processing. During behaviour, however, brain activity must integrate multiple circuits in different brain regions. Whole-brain recording with cellular resolution provides a new opportunity to dissect the neural basis of behaviour, but whole-brain activity is mutually contingent on behaviour itself, especially for natural behaviours such as navigation, mating or hunting, which require dynamic interaction between the animal, its environment and other animals. Many of the signalling and feedback pathways that animals use to guide behaviour only occur in freely moving animals. Recent technological advances have enabled whole-brain recording in small behaving animals including the nematode Caenorhabditis elegans, the fruit fly Drosophila melanogaster and the larval zebrafish Danio rerio. These whole-brain experiments capture neural activity with cellular resolution spanning sensory, decision-making and motor circuits, and thereby demand new theoretical approaches that integrate brain dynamics with behavioural dynamics. We review the experimental and theoretical methods used to understand animal behaviour and whole-brain activity, and the opportunities for physics to contribute to this emerging field of systems neuroscience.