And the answer to the kid’s question is possibly: Yes. His classmate’s skin would be brown because his ancestors lived in Africa, or some other tropical area, for thousands of years, while the white kid’s ancestors lived in colder climates: adaptation to climatic conditions over thousands of years.
That’s the nuts and bolts of it, alright.
Only someone looking to “make somethin’ of it” would think that any such observation/question was “racist”.
The question he was asking was - “why is some people’s skin darker than others”, and this could have been easily answered with your explanation. Instead, since it was a “white” child that asked it, the question was “racist”.