For centuries,Foeniculi fructus(F. fructus) has been used as a traditional herbal medicine in China and Europe and is widely used as a natural therapy for digestive disorders, including indigestion, flatulence, and bloating. The mechanism ofF. fructusthat alleviates functional dyspepsia was analyzed through network pharmacology, and its therapeutic effect on an animal model of functional dyspepsia were investigated. The traditional Chinese medicine systems pharmacology (TCMSP) database was used to investigate the compounds, targets, and associated diseases ofF. fructus. Information on the target genes was classified using the UniProtdatabase. Using the Cytoscape 3.9.1 software, a network was constructed, and the Cytoscape string application was employed to examine genes associated with functional dyspepsia. The efficacy ofF. fructuson functional dyspepsia was confirmed by treatment with its extract in a mouse model of loperamide-induced functional dyspepsia. Seven compounds targeted twelve functional dyspepsia-associated genes. When compared to the control group,F. fructusexhibited significant suppression of symptoms in a mouse model of functional dyspepsia. The results of our animal studies indicated a close association between the mechanism of action ofF. fructusand gastrointestinal motility. Based on animal experimental results, the results showed thatF. fructusprovided a potential means to treat functional dyspepsia, suggesting that its medical mechanism for functional dyspepsia could be described by the relationship between seven key compounds ofF. fructus, including oleic acid, β-sitosterol, and 12 functional dyspepsia-related genes.