A total of 25.7 million children in the United States are classified as overweight or obese. Obesity is associated with deficits in executive function, which may contribute to poor dietary decision-making. Less is known about the associations between being overweight or obese and brain development. To examine whether body mass index (BMI) is associated with thickness of the cerebral cortex and whether cortical thickness mediates the association between BMI and executive function in children. In this cross-sectional study, cortical thickness maps were derived from T1-weighted structural magnetic resonance images of a large, diverse sample of 9 and 10-year-old children from 21 US sites. List sorting, flanker, matrix reasoning, and Wisconsin card sorting tasks were used to assess executive function. A 10-fold nested cross-validation general linear model was used to assess mean cortical thickness from BMI across cortical brain regions. Associations between BMI and executive function were explored with Pearson partial correlations. Mediation analysis examined whether mean prefrontal cortex thickness mediated the association between BMI and executive function. Among 3190 individuals (mean [SD] age, 10.0 [0.61] years; 1627 [51.0%] male), those with higher BMI exhibited lower cortical thickness. Eighteen cortical regions were significantly inversely associated with BMI. The greatest correlations were observed in the prefrontal cortex. The BMI was inversely correlated with dimensional card sorting (r = -0.088, P < .001), list sorting (r = -0.061, P < .003), and matrix reasoning (r = -0.095, P < .001) but not the flanker task. Mean prefrontal cortex thickness mediated the association between BMI and list sorting (mean [SE] indirect effect, 0.014 [0.008]; 95% CI, 0.001-0.031) but not the matrix reasoning or card sorting task. These results suggest that BMI is associated with prefrontal cortex development and diminished executive functions, such as working memory.