I’d do some compute tests on a usb live system. Something like y-cruncher for instance. Could be all kinds of things. Power supply could be flaky, gpu, cpu,motherboard, storage. best suggestion is process of elimination.
Try using it with a gui and see if you can crash it if you don’t have alternatives for example. Check the storage’s smart health. Check dmesg. Ssh in when a crash happens if possible.