how much installed memory does your computer have? if your low on memory things may be slow and appear to hang if windows is swapping to disk. give it a while and see what happens. xp is usualy quite good at recovering from crashes. if you dont have much ram install some more. 512mb is a nice ammount.
what are you doing at the time when the computer locks up? playing games, using a particular program etc or is it just random?
when this happens try pressing 'CTRL+ALT+DEL' and see if task manager pops up. if it does then click on the 'applications tab' and see if anything is listed as 'not responding' if so click it and then click 'end task' maybe.
as above if you can get into task manager but nothing is listed as not responding maybe try clicking the 'processes' tab and look at what process is using all the cpu time here, may be the culprit, may not be but its worth a having a look anyway.
also take a look in event viewer 'start/control panel/administrative tools/event viewer' click the 'application' and 'system' tabs here and look for errors marked with a red x. click on them for more info and maybe a fix if its a known problem. note the dates and times of any hangs you have had and see if anything is listed here for that date and time.
check windows update and make sure windows is fully up to date click here
may help a bit.