Did the other organs all move together into their location, how did the brain get left out?
It’s an evolutionary answer – the bodies of most animals are essentially a tube with a mouth and an anus. Many early animals were pretty much just this (think of a flat worm) – primitive eyes, olfaction etc developed at the entry end because that’s where they’d be most useful for hunting, movement and so on.
As the sensory systems became more developed they required more processing power to make sense of the information they were gathering, forming more and more complex clusters of neurons. Eventually a group of animals called the craniates diverged, wrapping these neuronal clusters in protective layers of tissue and eventually bone, forming early skulls with jaws, eye sockets etc. It’s evolutionary advantageous to have the sensory organs and processing close together, so this set up was pretty stable.
Because evolution can’t go back and start again between generations, only tinker with what exists, the basic body plan of almost all animal life, with the sensory organs mostly clustered in one place, became set pretty early on, which is why virtually every animal has that basic set up with its brain separate from its body.
The positions of organs go back a LONG way, almost to the begging of animals. Most mobile animals have sensory organs in the front because that’s where they’re useful, the brain (or at least the closest analogue) right next to them (because it makes functional sense, neurons do have a limited “speed”), and then other organs throughout the rest of the body. But nerves are fairly fragile, and some groups of animals developed protection for them (or for the whole body, in the case of exoskeletons), which obviously also protected the brain. And as the brain grew, so did it’s protection, you end up with a head. Then evolve a neck, because it’s useful to be able to move your sensory organs and mouth around, and you end up with something like an ant or a mammal, with a brain in a clearly separate head.
I believe it has to do with sensory organs, mostly. If you look at less evolved creatures, like flatworms, you’ll find that the major ganglia (clumps of neurons that function as primitive brains) are clustered very near their eyes. In flatworms, the eyespots are immediately adjacent to those major ganglia. Crabs? Right near the eyestalks. Octopus? (Spoiler: it’s not in that big head-shaped sac.) Right behind the eyes. What’s fun about octopus anatomy is that they have ganglia controlling *each arm*, which considering how tactile they are, it would make sense to have mini brains at each tentacle.
Our bodies have evolved from very simple structures. Beyond a means of reproduction and ingestion of energy sources, we’ve simply “modded” ourselves to be better at staying alive, and you can’t have brains in with other things that move and shift and stretch. Neurons are delicate – moving them too much can damage them irreparably, as they do not regenerate very quickly at all. Look at squids: they have donut-shaped brains through which their esophagus passes (and is located – you guessed it – right behind the eyes). If they eat something a bit too big, they can suffer permanent brain damage as the food passes by. Given they they’re so sensitive, having brains in with things that move out change shape – lungs, heart, uterus, intestines, stomach – could spell disaster.
So brains get their own little nook right next to the main sensory organs, away from all the squishy organs that might bump up against them. Nicely protected from jostling in an enclosed case, they’re happy!
In order to survive, all living things have to consume energy. Certain organisms, like those from which we evolved from, consume energy by moving purposefully about their environment. One strategy for moving about the environment is to form a left side, and a symmetrical right side, which enables directional control. This is called “bilateral symmetry.” When the left side and right side work equally, the organism moves straight. For this to work most successfully, the organism needs the frontmost end in the center to sense where it’s going, quickly detect when it’s encountered something it can consume, and immediately detect when it’s encountered something dangerous. So these organisms will form “heads” at the front end, which contain all the apparatus most critical to performing those sensory functions. That evolutionary process is called “cephalization.”
The process of supplying nutrients to the rest of the organism’s bilateral body would mean the digestive organs and things that support them can distribute nutrients much more efficiently if they are located towards the middle of the body rather than towards one end.
We keep our gaming consoles, sound systems, Blu-ray player, and streaming boxes close to the TV. If they were far away, you would have to deal with long lengths of cable connecting them. This is annoying to support (longer cable costs more) and risks the signal being degraded over distance.
The same is with our brains. Our brain is in our head because our head contains many of our sensory organs. Sight, hearing, smell, and taste are all located in our head. Having a short distance between the sensory organs and our brains limits the “cable” (nerves) lengths needed to connect to our brains. This reduces the energy needed to grow and maintain the nerves and reduces the time it takes to send signals to the brain.