Because you don't want JavaScript mixed with HTML - content with behaviour. Preferably you want it in a separate file.
Having JS elsewhere has advantages and disadventages - it will be executed at different time, for instance, and you can write to the document from javascript located in the body.