The brain is encased in the head, the part of the body which in most walking, flying or swimming animals is the leading end of the moving body (with few exceptions: starfish, cuttlefish, humans, penguins when they are not swimming). The obvious risks which this localization entails are apparently compensated by the advantage of direct short connections with the sense organs localized in or on top of the head (olfaction, taste, vision, audition, vestibular sense), which together with the brain could be seen as something like the cockpit of the animal, or the pilot if one prefers.
Valentino Braitenberg (2007) "Brain". Scholarpedia, 2(11):2918.