A gene is a section of genetic code that gives instructions for a specific purpose. This gene section can be inherited, and changed ( mutation ), which is how different species evolve a variety of appearances and abilities.
There is a difference between "gene" ( a whole section of code related to hair in general ) and "allele" ( a unique version of that same gene section, like dark or light hair ). So everybody gets a hair gene, and we each get different alleles ( versions ) of that gene.
Some genes are tiny, just a small chain of bases. Other genes are quite big and could have thousands of bases. So when you think of a gene, it is like a building block of genetic material. And just like with legos there can be little ones, big ones, and they all have different purposes - most of which we have not even discovered yet!