This iconography is not regarded to exist in mainstream Hinduism, and has been primarily featured in the Tantra tradition only since the 15th century CE.
[4][5] The description of the appearance of Panchamukha Hanuman is found in a Tantric treatise called the Hanumat Rahashyam.
In one version, Rama and Lakshmana are captured by Ahiravana, and are offered to a goddess as sacrifices in Patala, the netherworld.
Hanuman rescues the brothers from their captivity, slaying the goddess,[8] and defeats Ahiravana by extinguishing five lamps simultaneously by manifesting his five faces.
According to one legend, after Brahma created a goddess, named either Saraswati, Savitri, or Gayatri, he grew infatuated by her, despite the protests of sages that she was his spiritual daughter.