Complex coumarins (CCs) represent characteristic metabolites found in Apiaceae plants, possessing significant medical value. Their essential functional role is likely as protectants against pathogens and regulators responding to environmental stimuli. Utilizing genomes and transcriptomes from 34 Apiaceae plants, including our recently sequenced Peucedanum praeruptorum, we conduct comprehensive phylogenetic analyses to reconstruct the detailed evolutionary process of the CC biosynthetic pathway in Apiaceae. Our results show that three key enzymes - p-coumaroyl CoA 2'-hydroxylase (C2'H), C-prenyltransferase (C-PT), and cyclase - originated successively at different evolutionary nodes within Apiaceae through various means of gene duplications: ectopic and tandem duplications. Neofunctionalization endows these enzymes with novel functions necessary for CC biosynthesis, thus completing the pathway. Candidate genes are cloned for heterologous expression and subjected to in vitro enzymatic assays to test our hypothesis regarding the origins of the key enzymes, and the results precisely validate our evolutionary inferences. Among the three enzymes, C-PTs are likely the primary determinant of the structural diversity of CCs (linear/angular), due to divergent activities evolved to target different positions (C-6 or C-8) of umbelliferone. A key amino acid variation (Ala161/Thr161) is identified and proven to play a crucial role in the alteration of enzymatic activity, possibly resulting in distinct binding forms between enzymes and substrates, thereby leading to different products. In conclusion, this study provides a detailed trajectory for the establishment and evolution of the CC biosynthetic pathway in Apiaceae. It explains why only a portion, not all, of Apiaceae plants can produce CCs and reveals the mechanisms of CC structural diversity among different Apiaceae plants.