Probably a kernel panic. I had the same problem with my M1 MacBook Air when I got it back in December of 2020. Happened 2-3 times a day back then, and continued even after doing software updates. Then it started happening more sporadically after about 5 software updates, then after the Monterey update it completely stopped - no more random reboots.
Try upgrading to Monterey if possible, and see if that fixes it.