Yes, we have been through this. My youngest son began 'refusing' school in Year 7. He would lock himself in the car, hide under the bed and so on. We worked with his Head of Year and with an educational social worker. It turned out that, on this occasion, there was some bullying going on.
The bullying boys were tactfully moved class and my son began to attend again.
However, in Year 9, the 'refusal' happened again. This time, it was accompanied by a profound health anxiety, a fear of contamination and other things. School were supportive. Once or twice, he managed to attend but had to be taught on a one-to-one basis in a separate room.
It became obvious that his anxious behaviours were not confined to school but permeated all his life (he would not enter shops, he stopped seeing any friends and so on). CAMHS became involved and he was taught by a local authority tutor for the rest of his school career.
So, as other posters have said, work with the school to see if there are any underlying issues or triggers, but you are doing exactly the right thing to try to get help for his anxiety.
I know when my son first started 'refusing' school, well-meaning friends told me to 'drag him in' and that he would be OK once he got through the door. I tried this, and it just increased his anxiety and made things worse.