Itaconate is an innate immune metabolite specifically produced in stimulated immune cells via the decarboxylation of the TCA cycle intermediate cis-aconitate. Due to its inhibition of succinate-related metabolic processes, itaconate exhibits antimicrobial properties at the expense of potentially disrupting the hosts own central energy metabolism, a double-edged dilemma of immunometabolism. To understand the evolutionary logic of itaconate biosynthesis, we investigate the evolutionary trajectory of the Irg1 gene, which codes for the itaconate-producing enzyme cis-aconitate decarboxylase (CAD). Phylogenetic analysis reveals a putative independent acquisition of metazoan and fungal Irg1 from prokaryotic sources. The metazoan Irg1 underwent duplication in vertebrates and a subsequent loss of one paralog in mammals, a process that removes the mitochondrial targeting sequences (MTS) and relocates CAD outside of the mitochondrial matrix thus preventing a direct inhibition of energy metabolism. Experiments in the most diverged metazoan species that are known to contain Irg1, oysters and amphioxus, reveal that the expression of primitive Irg1 genes is induced by innate immune stimulants in invertebrates and basal chordates, suggesting an already specialized role of itaconate production for innate immune defense in early bilaterians. Our combined in silico and experimental analysis of Irg1 highlights that a trend of tightened transcriptional regulation and sequence-level change optimizes itaconate biosynthesis for innate immunity, a mechanism that may be broadly utilized to resolve other types of double-edged dilemmas in immunometabolism.