<i>Cordyceps militaris</i>, a medicinal fungus rich in cordycepin, shows promise in treating diseases such as cancer, respiratory issues, and COVID-19. This study examines the impact of different Taiwanese rice varieties on its solid-state fermentation, focusing on optimizing cordycepin production. The results indicated that the cordycepin yield was indeed affected by the type of rice used. In terms of the fruiting bodies, germ rice resulted in the highest yield (13.1 ± 0.36 mg/g), followed by brown rice (11.9 ± 0.26 mg/g). In the rice culture medium (RCM), brown rice led to the highest yield (4.77 ± 0.06 mg/g). Using gas chromatography-mass spectrometry and untargeted metabolomics, the study identifies four key volatile components linked to cordycepin, providing insights into developing functional rice porridge products. These findings are significant for advancing cordycepin mass production and offering dietary options for older individuals.