The legume albumin-1 gene family, arising after nodulation, encodes linear a- and b-chain peptides for nutrient storage and defense. Intriguingly, in one prominent legume, Clitoria ternatea, the b-chains are replaced by domains producing ultra-stable cyclic peptides called cyclotides. The mechanism of this gene hijacking is until now unknown. Cyclotides require recruitment of ligase-type asparaginyl endopeptidases (AEPs) for maturation (cyclization), necessitating co-evolution of two gene families. Here we compare a chromosome-level C. ternatea genome with grain legumes to reveal an 8 to 40-fold expansion of the albumin-1 gene family, enabling the additional loci to undergo diversification. Iterative rounds of albumin-1 duplication and diversification create four albumin-1 enriched genomic islands encoding cyclotides, where they are physically grouped by similar pI and net charge values. We identify an ancestral hydrolytic AEP that exhibits neofunctionalization and multiple duplication events to yield two ligase-type AEPs. We propose cyclotides arise by convergence in C. ternatea where their presence enhances defense from biotic attack, thus increasing fitness compared to lineages with linear b-chains and ultimately driving the replacement of b-chains with cyclotides.