yea....i'm going to have to put some of the blame on the kid here
While yes it's partly on the kid in this situation with no more details, putting myself in his shoes (which I've done before) it's not hard to see why he could've done it:
1. Kids are stupid and don't think of consequences.
2. He was a clown/goofball so probably awkward funny
3. He moved into a new school and went for the self-deprecating humor to try and dissolve any possible tension that might exist and to establish himself as the funny guy.
I've done similar things where I make a joke at my expense/ethnicity to bring down any racial tension that might exist among my closest coworkers/people I want to be friends with. Unfortunately in his case it's a bad political climate and he didn't take into consideration a bully/racist using it against him.