Endophytic fungi can effectively regulate the biosynthesis of health-beneficial metabolites in plants. However, few studies have revealed how the accumulation of host metabolites varies during interactions with endophytic fungi. Here, pigeon pea hairy root cultures (PPHRCs) were cocultured with an endophytic fungus Penicillium rubens to explore the impact on the biosynthesis and accumulation of cajaninstilbene acid (CSA). The results showed that CSA accumulation in PPHRCs increased significantly (15.29-fold) during the early stages of P. rubens colonization (fungal attachment and invasion phases). Once P. rubens successfully colonized the intercellular gap of hairy roots to form a symbiotic relationship, the CSA levels in PPHRCs decreased drastically. Moreover, P. rubens could be recognized by plant pattern recognition receptors that regulate immunity/symbiosis, triggering the expression of genes related to pathogenesis, CSA biosynthesis, and ABC transporter. Overall, P. rubens could enhance the accumulation of health-promoting CSA in PPHRCs during the early stages of colonization.