To study the molecular basis for predator-prey coevolution, we investigated how Caenorhabditis elegans responds to the predatory fungus Arthrobotrys oligospora. C. elegans and other nematodes were attracted to volatile compounds produced by A. oligospora. Gas-chromatographic mass-spectral analyses of A. oligospora-derived volatile metabolites identified several odors mimicking food cues attractive to nematodes. One compound, methyl 3-methyl-2-butenoate (MMB) additionally triggered strong sex- and stage-specific attraction in several Caenorhabditis species. Furthermore, when MMB is present, it interferes with nematode mating, suggesting that MMB might mimic sex pheromone in Caenorhabditis species. Forward genetic screening suggests that multiple receptors are involved in sensing MMB. Response to fungal odors involves the olfactory neuron AWCs. Single-cell RNA-seq revealed the GPCRs expressed in AWC. We propose that A. oligospora likely evolved the means to use olfactory mimicry to attract its nematode prey through the olfactory neurons in C. elegans and related species.