The demon, Andhaka, wanted the goddess Parvati to be his wife. He tried to grab her by force so she called out to her husband, Shiva who immediately raised his trident and impaled the Asura.
But the Asura had a magic power; every drop of his blood that touched the ground turned into another Andhaka. The only way to kill him was to ensure not a single drop of his blood touched the ground, while he was impaled on Shiva’s trident.
Parvati knew that every divine being is a mixture of male and female forms, the male form representing mental potential and the female form representing material resources (Shakti). Parvati therefore called out to all the Shaktis. On her request, every divine being released their female energy who could drink the blood of Andhaka before it touched the ground. Soon the battlefield was filled with the shaktis of every god imaginable. Indra’s shakti emerged as Indrani, Vishnu’s shakti emerged as Vaishavi and Brahma’s shakti emerged as Brahmini. These shaktis drank the blood of Andhaka before it touched the ground. Thus was Andhaka destroyed.
Matsya Purana and Vishnu-dharmottara Purana list even Ganapati’s shakti in the list of female warrior goddesses. Her name was Vinayaki also known as Ganeshvari. This form of Ganapati is adored in the Vana-Durga-Upanishad.
Images of the female Ganesha start appearing from 16th century onwards. Some are of the opinion that these images perhaps represent Malini, the elephant-headed companion of Parvati, nursemaid to Ganesha, occasionally referred to in the Puranas.
The idea of a female elephant-headed deity whether it is the Shakti of Ganesha or the handmaid of Parvati is an integral part of Tantrik practices that preferred to see the divine in female, rather than the more dominant male form. This could be because in occult sciences, the female form was seen as the source of all generative powers: while the spark of life came from the male body, life finally was created and nourished by the female body. Or the reason could be more metaphysical. The female form was a code for material resources.
Sages in India have always had this debate between what matters more: the world of thoughts (mental potential) or the world of things (material resources). Those who veered towards intangible thoughts eventually came to be associated with Vedic practices while those who veered towards tangible things eventually came to be associated with Tantrik practices. The former coded their ideas through male forms while the latter coded their ideas through female forms. And so Ganesha, the remover of obstacles, gained popularity in Vedic circles, his female form, Vinayaki, became popular in Tantrik circles.
Were there stories associated with Vinayaki? We will never know as most of these ideas were oral. What we do know is that the fourth day after new moon is called Vinayaki Chaturthi. This day, which is sacred to Ganesha, is named after his female form.