Doctor Josh Dubnau explains that some genes are preferentially active in one part of the brain or body, while other genes are particular active in another location.
Genes all reside on the chromosomes of the animal. The chromosomes just contain the instructions, in most cases about how to make a protein. The proteins are made by first copying the DNA from a small part of the chromosome that encodes the gene by copying that DNA into RNA. That RNA is a message that is sent out of the nucleus of the cell into the cytoplasm, where the cytoplasm has the capability of then reading the sequence of letters in that messenger RNA and making the protein.
The act of a chromosomal gene being transcribed into a messenger RNA and then sent into the cytoplasm to make a protein is called gene expression. Not all genes are expressed in all cells at all times. If you look in the brain, you find something remarkable, and that is that of all the genes in our chromosomes, each gene is active in particular places and at particular times. Some genes are active preferentially in one circuit of the brain but not in another one. Other genes may be active in a second circuit but not the first one. We believe that imparts to those neuronal circuits, different abilities. That is why different neuronal circuits carry out different functions of our cognition.