The overuse of antibiotics has led to the enhanced resistance of many pathogenic bacteria, posing a threat to human health. Therefore, there is a need to develop green and safe alternatives to antibiotics. Beta-defensins play a crucial role in host defense against pathogens and have multifunctional properties, exerting key roles in innate and adaptive immunity, as well as non-immune processes. In this study, a 210 bp long cDNA sequence of yak DEFB114 gene was amplified and successfully expressed in a prokaryotic system. The DEFB114 protein exhibited significant inhibitory effects on the growth of Aspergillus fumigatus in vitro. When co-cultured with yak macrophages, DEFB114 protein enhanced macrophage phagocytic activity and increased nucleic acid fluorescence intensity (P < 0.05). DEFB114 protein also enhanced the activity of yak macrophages stimulated by inactivated Aspergillus fumigatus spores, increased the release of nitric oxide (NO), and promoted the expression of genes such as γ-actin, Lgals, Man2b, and Capg (P < 0.05). In mice experiments, DEFB114 protein promoted resistance against Aspergillus fumigatus infection, by regulating the NOD1/2-ATG16L1-NF-κB pathway to modulate the host immune response and exert its anti-infective effects. In summary, the yak DEFB114 protein could inhibit the growth of Aspergillus fumigatus and enhance the animal's resistance to pathogenic microorganisms, thereby having significant implications in the treatment and prevention of fungal infections.