My iMac shuts down and restarts when I try to run Illustrator. It sometimes shuts down immediately upon opening Illustrator but it varies. I can sometime work for maybe 20 minutes and I think it is fine but a keystroke from the keyboard or moving the cursor will cause the shutdown. I just switched from a Macbook to the iMac.
iMac (Retina 5K, 27-inch, 2020)
Processor 3.8 GHz 8-Core Intel Core i7
Memory 32 GB 2667 MHz DDR4
Graphics AMD Radeon Pro 5500 XT 8 GB
It doesn't seem to matter whether I use the supplied Magic Mouse and Keyboard or whether I use my Logitech M575 trackball mouse. I also have a Wacom Intuos Pro Tablet but it is not connected.
The only time I had a similar experience was with Photoshop, when I accessed neural filters, which simply do not play with my perfectly fine and accessible GPU. I resolved it there, by turning off GPU under Preferences>Performance, when accessing those functions. Perhaps that's what's happening with Illustrator, for you. Please turn of your GPU, under Preferences>Performance, and see if that resolves the issue.
I have removed all peripherals and it has been fine so now I will have to attach them one at a time to see what the issue is. I only had an external monitor, Logitech Bluetooth mouse and the ethernet line so I should know soon what it is.