The first models which tried to explain the clustering of genes were, of course, focused on operons because they were discovered before eukaryote gene clusters were. In 1999 Lawrence proposed a model for the origin operons. This selfish operon model suggests that individual genes were grouped together by vertical en horizontal transfer and were preserved as a single unit because that was beneficial for the genes, not per se for the organism. This model predicts that the gene clusters must have conserved between species. This is not the case for many operons and gene clusters seen in eukaryotes.
According to Eichler and Sankoff the two mean processes in eukaryotic chromosome evolution are 1) rearrangements of chromosomal segments and 2) localized duplication of genes. Clustering could be explained by reasoning that all genes in a cluster are originated from tandem duplicates of a common ancestor. If all co-expressed genes in a cluster were evolved from a common ancestral gene it would have been expected that theyre co-expressed because they all have comparable promoters. However, gene clustering is a very common tread in genomes and it isnt clear how this duplication model could explain all of the clustering. Furthermore, many genes that are present in clusters are not homologous.
How did evolutionary non-related genes come in close proximity in the first place? Either there is a force that brings functionally related genes near to each other, or the genes came near by change. Singer et al. proposed that genes came in close proximity by random recombination of genome segments. When functionally related genes came in close proximity to each other, this proximity was conserved. They determined all possible recombination sites between genes of human and mouse. After that, they compared the clustering of the mouse and human genome and looked if recombination had occurred at the potentially recombination sites. It turned out that recombination between genes of the same cluster was very rare. So, as soon as a functional cluster is formed recombination is suppressed by the cell. On sex chromosomes, the amount of clusters is very low in both human and mouse. The authors reasoned this was due to the low rate of chromosomal rearrangements of sex chromosomes.
Open chromatin regions are active regions. It is more likely that genes will be transferred to these regions. Genes from organelle and virus genome are inserted more often in these regions. In this way non-homologous genes can be pressed together in a small domain.
It is possible that some regions in the genome are better suited for important genes. It is important for the cell that genes that are responsible for basal functions are protected from recombination. It has been observed in yeast and worms that essential genes tend to cluster in regions with a small replication rate.
It is possible that genes came in close proximity by change. Other models have been proposed but none of them can explain all observed phenomena. It's clear that as soon as clusters are formed they are conserved by natural selection. However, a precise model of how genes came in close proximity is still lacking. 
The bulk of the present clusters must have formed relatively recent because only seven clusters of functionally related genes are conserved between phyla. Some of these differences can be explained by the fact that gene expression is very differently regulated by different phyla. For example, in vertebrates and plants DNA methylation is used, whereas it is absent in yeast and flies.