Why do system restart automatically

That's an extremely vague description of the problem... When does it restart (as in, what are you doing on it when it restarts, usually?) How old is it? What brand/model? Do you have antivirus software on it? Please give us more detail please :)
 
That is what we lovingly refer to as a "crash". Could be any number of things, from memory that needs to be reseated, to overheating of some component, to a software or driver conflict, or a bad PSU supplying a weak or "dirty" power flow.