The deity Gaṇeśa is ubiquitous in Hindu culture. In modern India and Nepal one can easily find shrines to him and his portrait is readily seen in shops and in homes. He is generally understood as a bringer of fortune. In more technical theological terms, he is the creator of obstacles (vighna-kartā) and their remover (vighna-hartā), though my impression is that modern Hindu traditions see him as entirely benevolent. He is normally depicted as fat and dwarf-like with his rat mount at his feet or nearby. His history in Hinduism is quite colorful and interesting, but less known is his presence in Buddhism. He is seen in East Asian, Tibetan and SE Asian Buddhist cultures.
In the materials I’ve surveyed so far, I have not seen the elephant-headed deity referred to as Gaṇeśa in Buddhist literature, which is likely because that name was a fairly late development in classical Indian history. In Buddhist literature he is normally referred to by his historically older appellations of Gaṇapati or Vināyaka.
In Buddhist India it seems there were mixed and conflicting interpretations of Vināyaka, which is demonstrated both in the archaeological record of India and in the relevant literature translated into Chinese during the Tang (618–907) and early Northern Song (960–1127) periods.
I remember a few years ago when I was visiting the museum at Nālandā in India I saw a statue on display in which Gaṇeśa was being trampled upon by a Buddhist deity.
It was surprising at the time, but later I read Giovanni Verardi’s Hardship and Downfall of Buddhism in India in which he explains how the representation of violence in Buddhist artwork, which started in the ninth century, actually reflected real violent struggles between two competing socio-political models: Buddhism and Brahmanism. He argues that the violence one sees in Vajrayāna iconography emerged in an atmosphere of interreligious war and bloodshed, though many scholars – particularly in India which is often ideologically committed to the notion of India always having enjoyed interreligious harmony – are unwilling to accept this.
A few years later I had the opportunity to sit down and have tea with the famous Indian scholar Lokesh Chandra (b. 1927) in New Delhi. I asked him what he thought of Verardi’s thesis and he commented that there is no evidence of violent conflict between Brahmins and Buddhists. I imagine many Indian scholars would also disagree with Verardi’s conclusions.
Returning to the images in question, we might look at the following specimen from Bihar, dating to the tenth century. It shows Aparājitā subjugating an elephant-headed god, which could be the Purāṇic Gaṇeśa or a general vināyaka (a class of malignant being associated with obstacles) rather than the Vināyaka who appears in Buddhist Tantric literature as a single deity. In either case, it does demonstrate that such an elephant-headed figure was to be subjugated by a Buddhist deity and presumably treated as a tīrthika god.
Here is another specimen:
Despite these representations, Buddhist literature translated into Chinese speaks of a Vināyaka that is regarded either as a malignant being (or beings) or as a deity who is sympathetic to Buddhism and associated with Avalokitēśvara Bodhisattva.
One early example of the former understanding is presented in the Mahāvairocana-sūtra 大日經 (T 848), which dates to sometime in the early to mid-seventh century (see here for details). It mentions vināyakas 毘那夜迦 alongside other evil beings who are to be dispersed through the power of mantra. The text’s commentary by Śubhakarasiṃha 善無畏 (637–735) and Yixing 一行 (683–727) defines vināyaka 毘那也迦 as hindrances which are produced from a deluded mind (從妄想心生). This indicates that vināyaka was originally regarded as negative in early Tantra. The deity appears in the accompanying Garbhadhātu-maṇḍala 胎藏界曼荼羅. He is represented with an elephant head, holding a hatchet and radish:
There is another common depiction of Vināyaka in East Asia, which is a pair of elephant-headed figures embracing one another. They are understood to be male and female. The female is an emanation of Avalokitēśvara Bodhisattva.
I am presently unaware of any precedent for this in Indian archaeology (though I would be happy if someone pointed it out). This depiction became quite common in Japan and anyone involved in Shingon or Tendai will immediately recognize the figure as Kangiten 歡喜天.
There is a story behind this image which is preserved in the Japanese Tendai Asaba shō 阿娑縛抄, which is a compendium of Buddhist iconography compiled by Shōchō 承澄 (1205–1281). It is entitled the “Secret Legend of Vināyaka” 毗那夜迦密傳 (see Taishō zuzō 大正圖像, vol. 9: 486a). It reads as follows.
有山名毗那夜迦山，此云象頭山，又名障礙山，其中多有毗那夜迦，其聖名歡喜，與其眷屬無量眾，俱受大自在天敕，欲往世界奪眾生氣，而作障難，是摩醯首羅來歸佛法體也。爾時，觀自在菩薩大悲薰心，以慈善根力，化為毗那夜迦婦女身，往彼歡喜王所。于時彼王見此婦女，慾心熾盛，欲觸彼毗那夜迦女，與抱其身。于時障女形不肯受之，彼王即作愛敬，於是，彼女言，我雖似障女，從昔以來，能受佛教，得袈裟衣服，汝若實欲觸我身者，可隨我教，即如我至于盡未來世能為護法不? 又從我護諸行人，莫作障礙不? 又依我已後，莫作毒不耶 ? 汝受如此教者，為親友。時毗那夜迦言，我依緣今值汝等，從今已後，隨汝等語，修護佛法。時毗那夜迦女含笑而相抱。
There was a mountain named Vināyaka Mountain. This was called ‘Elephant Head Mountain” or otherwise called ‘Obstacle Mountain’. There were many vināyaka-s there. Their sage was called *Nandi, who together with an immeasurable retinue received the commands of Mahēśvaradeva. He wanted to go into the world and steal the *prāṇa of beings and create obstacles. Mahēśvara took refuge in the Buddhadharma. At that time, Avalokitēśvara Bodhisattva [possessed] a mind perfumed with great compassion. He transformed into a vināyaka maiden with the power of compassionate and virtuous roots before going to *King Nandi. Then the king saw this maiden and became engulfed in passionate desire. He wanted to touch the vināyaka maiden and embrace her body. Then [Avalokitēśvara] in the form of a vināyaka maiden would not allow it. The king fell in love with her. The maiden thus said, “Although I appear to be a vināyaka maiden, long ago I received the Buddha’s teachings and acquired the kāṣāya garments. If you truly want to touch my body, you should follow my instructions. Will you be able to protect the Dharma as I have for all time to come? Furthermore, will you not create obstacles for practitioners whom I protect? Furthermore, will you not make poisons after you follow me? If you accept these instructions, we will be friends.” Vināyaka then said, “I have now met you in accordance with conditions. From now on I will follow your words, practicing and protecting the Buddhadharma.” The vināyaka maiden smiled and the two embraced.
I feel the Chinese here to be quite unorthodox and I suspect it is Chinese composed by a Japanese hand. This does not necessarily negate the possibility of it having an earlier Chinese precedent, but given that it is a ‘secret legend’ it might have been orally transmitted.
There is another account in one of the sādhana texts specifically related to Vināyaka, which is attributed to Śubhakarasiṃha (大聖歡喜雙身大自在天毘那夜迦王歸依念誦供養法; T 1270). It states that Mahēśvara and his wife Umā produced 3000 children. King Vināyaka was the first of 1500 “on the left”. He carried out evil deeds, leading 107,000 vināyaka-s. His sibling (sister?), whose name appears to be something like *Śanayaka 扇那夜迦 is virtuous and an emanation of Avalokitēśvara. In order to tame Vināyaka they become “siblings, man and wife” 兄弟夫婦 (an incestuous union?), expressed in the form of an embracing pair. Again the Chinese is quite strange and I suspect it was composed by a Japanese author and not Śubhakarasiṃha. However, it does refer to another text and state the story behind this union is related there. I am unable to identify this text, but my tentative conclusion would be that these two accounts were based on an earlier Indian text translated into Chinese at some point. The Gaṇapati Strotra (translated into Tibetan as Tshogs kyi bDag po la bsTod pa) addresses Gaṇapati as an emanation of Avalokitēśvara, so this association between the two deities definitely has an Indian precedent.
All of the material mentioned above indicates that Buddhists in India throughout the centuries had disparate and conflicting interpretations of the deity. Gaṇapati was originally neither Vedic nor Buddhist. His origins are a debated topic (some even suggest an Egyptian inspiration). Regardless of his origins, he clearly became a popular deity after the fifth century and thereafter authors of Purāṇas and Buddhist sūtras made efforts to accommodate and incorporate him into their pantheons. He even came to have a place in Jainism.