Social insects live in closely related family groups but face risks of intrusion and infection by pathogenic and parasitic microbes. To cope with the microbes invading their nests and feeding sites, social insects produce various types of antimicrobial substances. Subterranean termites occupy microbe-rich decaying wood and soil at high density, expanding their nest area by exploring and feeding on wood outward from the royal chamber (room for kings and queens). Although antimicrobial agents have been identified in many termite species, few studies have investigated those used by foraging workers in decaying wood under development, which is richer in microbes than the well-sterilized royal chamber and its surroundings. Here, we report that phenylacetic acid, an antifungal aromatic compound, is secreted by foraging workers of the Japanese subterranean termite Reticulitermes speratus. The compound was detected by gas chromatography–mass spectrometry analysis of ethyl acetate extracts of shelter papers infested with the workers, and antimicrobial tests demonstrated that it inhibits the germination and/or mycelial growth of the entomopathogenic fungi (Metarhizium anisopliae and Beauveria bassiana) and the termite egg-mimicking fungus Athelia termitophila. Our study provides new insights into the antimicrobial defense mechanisms of termites, including by combining different types of antimicrobial substances secreted by different castes, and thus the survival strategy of entomopathogenic and parasitic fungi in termite nests.