Unrelated genes establish head-to-tail polarity in embryos of different fly species, raising the question of how they evolve this function. We show that in moth flies (Clogmia, Lutzomyia), a maternal transcript isoform of odd-paired (Zic) is localized in the anterior egg and adopted the role of anterior determinant without essential protein change. Additionally, Clogmia lost maternal germ plasm, which contributes to embryo polarity in fruit flies (Drosophila). In culicine (Culex, Aedes) and anopheline mosquitoes (Anopheles), embryo polarity rests on a previously unnamed zinc finger gene (cucoid), or pangolin (dTcf), respectively. These genes also localize an alternative transcript isoform at the anterior egg pole. Basal-branching crane flies (Nephrotoma) also enrich maternal pangolin transcript at the anterior egg pole, suggesting that pangolin functioned as ancestral axis determinant in flies. In conclusion, flies evolved an unexpected diversity of anterior determinants, and alternative transcript isoforms with distinct expression can adopt fundamentally distinct developmental roles., eLife digest With very few exceptions, animals have ‘head’ and ‘tail’ ends that develop when they are an embryo. The genes involved in specifying these ends vary between species and even closely-related animals may use different genes for the same roles. For example, the products of two unrelated genes called bicoid in fruit flies and panish in common midges accumulate at one end of their respective eggs to distinguish head from tail ends. It remained unclear how other fly species, which have neither a bicoid nor a panish gene, distinguish the head from the tail end, or how genes can evolve the specific function of bicoid and panish. Cells express genes by producing gene templates called messenger ribonucleic acids (or mRNAs for short). The central portions of mRNAs, known as protein-coding sequences, are then used to produce the protein. Proteins can play several distinct roles, which they acquire through evolution. This can happen in different ways, for example, genetic mutations in the part of a gene that codes for protein may alter the resulting protein, giving it a new activity. Alternatively, sequences at the beginning and the end of an mRNA molecule that do not code for protein, but regulate when and where proteins are made, can influence a protein’s role by changing its environment. Many genes produce mRNAs with alternative sequences at the beginning or the end, a process known as alternative transcription. Here, Yoon et al. identified three unrelated genes that perform similar roles to bicoid and panish in the embryos of several different moth flies and mosquitoes. These genes appear to have acquired their activity because one of their alternative transcripts accumulated at the future head end, rather than through mutations in the protein-coding sequences. Studying multiple species also made it clear that panish inherited its function from a localized alternative transcript of an old gene that duplicated and diverged. These findings suggest that alternative transcription may provide opportunities for genes to evolve new roles in fundamental processes in flies. Most animal genes use alternative start and stop sites for transcription, but the reasons for this remain largely obscure. This is especially the case in the human brain. The findings of Yoon et al., therefore, raise the question of whether alternative transcription has played an important role in the evolution of the human brain.