Bless him. I hope it does get better for you all.
Something I wish someone had explained to me sooner is about how DC can get into a dysregulated state - you probably know this state even though you may not have words for it. They get "silly" and OTT, or like at school today, one tiny thing will set them off, they will totally overreact and then someone (adult or other child) responds in a totally reasonable way and they are just rude/defiant/aggressive back and it spirals because the adult then intervenes more etc.
It's useful to understand what's happening in their body/brain at this time because it just seems like they are being awful on purpose or bratty or it is a kind of control thing. But actually what it seems to be is basically their nervous system is reacting to whatever is happening around them as though it is a threat. So they will reflexively lash out or do whatever will get them out of the current situation (some kids bolt, some are silly or laugh or blame others, some, particularly kids on the autism spectrum might just go into a non-responsive state e.g. rolled up in a ball)
Why does their nervous system do that? It's to do with a build up of stressors. School is a bundle of stressors. There are other children to deal with, the actual learning/concentrating can be stressful, there might be sensory overload (noise, fluorescent lighting, smells, temperature etc), there might be emotional stress (bullying/being told off/excitement about an upcoming treat), there are a lot of transitions (it's lunch time, it's carpet time, we are doing maths, we are doing singing). This time of year is particularly hard for children with a reactive nervous system because it's out of the usual routine, the children are generally excited, which means they are noisy and impulsive, and there is a lot more sensory stimulation everywhere - lights and shiny decorations and music and lots of anticipation and excitement.
Think of it like a kind of "buckaroo" - those normal everyday stresses build up and up and it just takes one thing like being brushed by another child and they explode. But it wasn't that one item that caused it, it's the combined weight of all the items that triggers the explosion.
The focus at this time should then be getting the child out of the overstimulating environment and somewhere where they can calm down and regulate and helping them regulate again. Instead the usual response (understandably) is admonishment and punishment which just tends to fuel the fire. The DC by the end will give a totally nonsensical response (like "I just wanted to") because they probably have absolutely no idea why they responded like that and perhaps don't even know or remember what triggered the incident. Also, even if they do remember, they could tell you about the child brushing them but they can't explain about the Christmas decorations reflecting the light in their eyes and the singing that replaced their favourite lesson and the teacher's voice being extra loud because she was annoyed with the other children and the smell of the school dinner making them feel ill and the radiator being too hot and their sock being sweaty and having slipped halfway down into their shoe. Because they won't put all of that together and understand the buckaroo effect. Even adults don't do this so a five year old is not going to in a million years.
I totally understand giving him a consequence when he got home. It's up to you whether you do this or not. Maybe just observe and see if it is helpful or not. Please don't listen to people who are absolutist and say things like "You must always back up the school by punishing at home" or "You must never punish at home for dysregulated behaviour at school". You are absolutely right not to let it drag on and on or be overly angry at him but a lot of families do find that a mild consequence like this helps to set the same message as school. While others find that it is more helpful to leave the consequences in school and work on destressing at home instead, finding that a punishment at home just adds to the stuff on the "buckaroo saddle". For example some people find that their children use the TV to regulate their emotions, so in that case it might be a counterproductive thing to use. Honestly it's all very trial and error unfortunately.
If you want to learn more about dysregulation the best resources I've found have been Stuart Shanker, Mona Delahooke, TheOTButterfly, The Occuplaytional Therapist. The first two have books and the latter two are on social media/have websites. There is also a FANTASTIC book/program for schools called Conscious Discipline which is all about self regulation skills. You probably don't need to go in insisting they change everything about their discipline policy
but if you look on their website/youtube/listen to a podcast interview with the author, there are so many different skills and tools outlined and you might be able to take individual parts and request them as an accommodation for him. (This is not something I've got to yet, as I didn't know all of this until DS1 had left primary school, and DS2 hasn't started school yet).
Then there is also Ross Greene/ the Explosive Child for another take on why children explode - but this is more about identifying problem situations that keep reoccurring and working out a way to change the scenario so that it doesn't keep happening. I think the emotional regulation stuff is probably more useful as a first thing to look at.