It seems like he's having a sort of "performance" anxiety thing happening. He is okay with social stuff - but gets all worked up when having to face his lack of performing or completing his expectations where school is the focus. This might sound weird - but was he ever "shamed" as a child for not doing what was expected of him??? Where one or both parents hard on him and made him feel shameful for not meeting up to their expectations?? Or maybe in school did he have a particularly tough teacher?
Its obviously not a generalized anxiety issue since he's only having trouble facing the school related stuff. I just think there must be a root cause for this as it seems to make no sense (at least from my limited point of view). If you can find the root cause (if there is one) it might help him work through this current anxiety. Just have to help him see that the circumstances are not related and he doesn't need to fear facing this situation head on. Help him see that by tackling the school issues he will be stronger and the former situation will no longer control him.