Based on data from the United States National Health and Nutrition Examination Survey (NHANES), this study investigated whether the association between urinary trace metals and obesity changes with age. A multinomial logistic regression was used to explore the association between metals and obesity. We built models based on rolling window data with a seven-year time interval to investigate the trend of odd ratios (ORs) in metals. Finally, an application was built to show the trend of the ORs of metals with age. We found that obesity was positively associated with barium but negatively associated with cobalt, cadmium, and lead among children and adolescents. The trend analysis shows that different metals have different trends. Both barium and cobalt showed an age-related trend, and the younger the age, the greater the effect; the former and the latter were positively and negatively correlated with obesity, respectively. Lead showed no trend. The length of the confidence interval of barium's ORs decreased with age, whereas the confidence interval lengths for cobalt's OR values did not show significant changes across age groups. Our results indicate that: 1. The body mass index (BMI) of younger children is more susceptible to certain metals. 2. Barium's effect on young children is highly volatile. 3. The effects of cobalt on children of different ages are less volatile.