This may be entirely off-base, so feel free to disregard, but the situation reminds me in some ways of my DDs fifth grade year. It really sounds like he is trying his best not to stand out, and that is super-familiar to me.

For us, 5th grade was the year where DD became hyper-aware of how different she is. There were no real academic peers in the classroom, and her teacher, who was described by many as wonderful, was problematic, but I didn’t see it immediately. She liked to read DDs work to the class (big red flag) and had a long-standing habit of reading offf the kids who got 100 on anything (which of course always included DD). By the time we were clued in to this, it was Too late. There was significant relational bullying among th kids, and DD was the main target, thanks fo a very jealous ex-best friend, who was very savvy at manipulation. The teacher actually dismissed us several times when we expressed concern, with the statement that it couldn’t be true because ex-bestie was such a nice girl, yada yada... Our conference with the teaching team went much the same, none of the teachers really saw or believed it. By the end of the year, the counselor was in the classroom doing a routine character Ed exercise, when she had to stop the whole thing (the bullying by then was blatant). For the next class year DD had a hand-picked teacher and believe it or not, several hand-picked classmates, but to this day I regret not catching on sooner. She has struggled with anxiety and trust, and rebellion against school authority. She is also very good now at standing up for herself and for others.

Anyway, I would do some sleuthing- see if you can get a real read on the teacher, and any other teachers who might see him interacting in class/school. See if the counselor is helpful (ours was mostly not, but you never know). Try and observe, if you can- anywhere he is with friends, as friend groups shift a lot during this time and it’s possible he is adrift between groups, finding his place as you said. Find places where he can be himself, if possible- this was very hard for us at this age, but got better when DD was old enough to join an academic team in middle school (7th for us)- but it could be anywhere, not just school. And hopefully he has some academic peers at school- DD was in a pullout, but it was not nearly enough, and the kids not near enough intellectually, to help much.