Infants' bodies, brains, and environments are ever-changing. Although this continuous transformation is a fundamental feature of development, how infants actively adapt and learn amidst such volatility is still unknown. To address this, we devised a novel learning task in which the location of a reward was systematically altered, transitioning from stable to volatile periods. Through computational modelling, we inferred from the infants' gaze and pupil data the learning processes that enabled them to navigate these changing environments. We found that infants' tonic pupil size reflected trial-by-trial changes in the level of environmental volatility. Moreover, phasic changes in pupil size when observing the reward indicated that infants relied on the information about volatility to optimize their learning. This resulted in the successful performance of the task, as indicated by the pattern of anticipatory looks to the correct reward locations. Together, these results identify the active role that infants play in adapting to change.