PC reboots when gaming

Oct 27, 2018
1
0
10
I just bought a pc with following specs :
Intel i5-8400
8gb ddr4 ram
Saphire nitro+ rx580
Asus TUF gaming b360m
Toshiba dt01aca100 1TB
ZM 500-TX (PSU) (500W)
6x rgb fan

I was playing rainbow six siege with this pc on ultra 60fps and this pc reboots randomly without any warning, after reading some forums i think that it might be the fans because they requires alot of power.
but i dont know if i am right because i am new to building pc so i am here asking what happened
when i try to change the refresh rate the pc reboots too
sorry for bad english