Air pollution exposure may affect child weight gain, but observational studies provide inconsistent evidence. Residential relocation can be leveraged as a natural experiment by studying changes in health outcomes after a sudden change in exposure within an individual. We aimed to evaluate whether changes in air pollution exposure due to residential relocation are associated with changes in body mass index (BMI) in children and adolescents in a natural experiment study. This population-based study included children and adolescents, between 2 and 17 years, who moved during 2011-2018 and were registered in the primary healthcare in Catalonia, Spain (N = 46,644). Outdoor air pollutants (nitrogen dioxides (NO2), particulate matter <10 μm (PM10) and <2.5 μm (PM2.5)) were estimated at residential census tract level before and after relocation; tertile cut-offs were used to define changes in exposure. Routinely measured weight and height were used to calculate age-sex-specific BMI z-scores. A minimum of 180 days after moving was considered to observe zBMI changes according to changes in exposure using linear fixed effects regression. The majority of participants (60-67% depending on the pollutant) moved to areas with similar levels of air pollution, 15-49% to less polluted, and 14-31% to more polluted areas. Moving to areas with more air pollution was associated with zBMI increases for all air pollutants (β NO2 = 0.10(95%CI 0.09; 0.12), β PM2.5 0.06(0.04; 0.07), β PM10 0.08(0.06; 0.10)). Moving to similar air pollution areas was associated with decreases in zBMI for all pollutants. No associations were found for those moving to less polluted areas. Associations with moving to more polluted areas were stronger in preschool- and primary school-ages. Associations did not differ by area deprivation strata. This large, natural experiment study suggests that increases in outdoor air pollution may be associated with child weight gain, supporting ongoing efforts to lower air pollution levels.