In the brain proper, grey matter forms the outer layer of the brain, and white matter forms the inner layer. In the spine, this is reversed: white matter forms the outer layer of the spine, and grey matter the inner layer. Is there a developmental or functional reason for this?
I'll tackle this question from a functional point of view.
Gray matter are cell bodies, white matter are myelinated fiber tracts.
In the brain, the gray matter is basically the cortex, the white matter lies mainly underneath it. The Cortex is the place where all the higher mental processing takes place (Fig. 1).
Fig. 1. Cortical functions. Source: Penn Medicine
The white matter in the brain connects the various parts of the cortex so that information can be transported for further processing and integrated.
Fig. 2. Central white matter. Source: NIH Medline
Since the cortex is the 'processor', it makes sense to connect the parts subcortically (more efficient as it leads to shorter connections). However, the cortex has been expanding very late in evolution, so this 'endpoint reasoning' can be contested, because from an evolutionary perspective, more cortex was needed and hence it was expanded right where it happened to be, namely in the outer part of the brain.
In the spinal chord things are pretty much reversed; grey matter within, white matter around it (Fig. 3).
Fig. 3. Section through spinal chord with central grey matter and surrounding white matter. Source: University of Michigan
The white matter, again, is formed by various tracts (Fig. 4) and the grey matter with parts that are processing information (fig. 5).
Fig. 4. Section through spinal chord showing the spinal tracts forming the white matter. Source: Biology.SE
Fig. 5. Section through spinal chord showing the spinal reflex arches forming the gray matter. Source: APSU Biology
The white matter in the spinal chord constitutes the various sensory and motor pathways to and from the brain, respectively. The gray matter constitutes basic processing nuclei that form the reflex arches in the spinal chord. These reflex arches process incoming sensory information (e.g. pain) and govern motor output (e.g., pulling the hand away from the fire).
Again, the structure makes sense in terms of efficiency, as the reflex arches combine the sensory and motor tracts to govern reflexes, and therefore processing them from within saves space.
This is a simple logic to understand. In the brain the grey matter is on the cotex.Grey matter is a tissue made of the cytons due to which the cotex is pinkish Grey in colour. The White matter,the tissue made of axons is inside to the brain. Cortex is the processing centre which has cytons. In the spine the processing is to be done internally. So the cytons concentrate inside the spine which we call the Grey matter.Similarly the axons are to be around the Grey matter to transfer messages from and to other organs.They form the White matter outside the spine.
Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.