The tropane alkaloids (TAs) cocaine and hyoscyamine have been used medicinally for thousands of years. To understand the evolutionary origins and trajectories of serial biosynthetic enzymes of TAs and especially the characteristic tropane skeletons, we generated the chromosome-level genome assemblies of cocaine-producing Erythroxylum novogranatense (Erythroxylaceae, rosids clade) and hyoscyamine-producing Anisodus acutangulus (Solanaceae, asterids clade). Comparative genomic and phylogenetic analysis suggested that the lack of spermidine synthase/N-methyltransferase (EnSPMT1) in ancestral asterids species contributed to the divergence of polyamine (spermidine or putrescine) methylation in cocaine and hyoscyamine biosynthesis. Molecular docking analysis and key site mutation experiments suggested that ecgonone synthases CYP81AN15 and CYP82M3 adopt different active-site architectures to biosynthesize the same product ecgonone from the same substrate in Erythroxylaceae and Solanaceae. Further synteny analysis showed different evolutionary origins and trajectories of CYP81AN15 and CYP82M3, particularly the emergence of CYP81AN15 through the neofunctionalization of ancient tandem duplication genes. The combination of structural biology and comparative genomic analysis revealed that ecgonone methyltransferase, which is responsible for the biosynthesis of characteristic 2-substituted carboxymethyl group in cocaine, evolved from the tandem copies of salicylic acid methyltransferase by the mutations of critical E216 and S153 residues. Overall, we provided strong evidence for the independent origins of serial TA biosynthetic enzymes on the genomic and structural level, underlying the chemotypic convergence of TAs in phylogenetically distant species.