Hello Shivi,
Right-Click the My Computer icon on desktop. Select Properties.
Next, select Advanced. Look for a block that says Startup and recovery. Press the settings button.
In System failure section, turn off (un-check) Automatically restart. Apply change.
Have you checked your Power Management settings?
Get into Control Panel----Power Management---and turn on APM ---Advanced Power Management .
See Windows XP Shutdown & Restart Troubleshooting at
http://aumha.org/win5/a/shtdwnxp.htm
See what Event Viewer has in it's log. Select Start button/ select Run , then type in
eventvwr.msc<enter>
-- or Go to Control Panel / Performance and Maintenance/Administrative Tools >Event Viewer.
Review the sections and look for Errors or Warnings.
Double click---the information "may" give a clue.