Historically The Passage where the real Ganesha appears is in the epic Mahabharata (to be precise appears in the introductory scene of Rajasekhara's Balabharata) in which Ganesha has been said to have written down the entire epic script at the dictation of Vyasa.
Also , In the Tantra of the Great Ganapati is written :
An appparition (Nirmana) by the great God Mahaganapati is brought
about by the force of a disciple with the fortune to attain
accomplishment (in this life, from previous births)
So then most of the sites where the Lord appeared to his devotees became temples.
At Ranthambore Ganesh ji (Rajasthan)

According to the history behind this temple, it is said that in 1299 AD, a war took place between King Hammeer and Alauddin Khilji at the Ranthambore fortification. During the war time, they filled there godowns with foods and other necessary things in Ranthambore Fort, where the King dwells. As the war lasted for many years, the stored things in godowns were getting over. King Hammer was a great devotee to God Ganesh. One night when he was sleeping, Lord Ganesh came in his dream and said that all the lacking and problems would be over by tomorrow morning. Next day morning, an idol of Lord Ganesh with three eyes (Trinetra) stamped from one of the walls of the fort. Also, a miracle took place and the war got over while the godowns got filled again. In 1300 AD, King Hammer built a temple of Lord Ganesh. He placed the idol of Lord Ganesh, Riddhi Siddhi (his wife) and two.
Ucchi Pillayar Temple

Vibhishana, though he supported Rama, was basically an Asura, hence the Devas wanted to stop this idea of an Asura taking Lord’s supreme form to his Kingdom. They request the help of the Remover of obstacles and God of learning, Lord Vinayaka and the Lord accepts the plan. Vibhishana, while on his back to his Kingdom, goes through Trichi, and wanted to take his bath in the river Kaveri and do his daily rituals. However, he is perplexed as the deity, once kept in land, can never be removed and has to be in that place forever.
As a solution, Vibishana tries to find someone to hold the deity while he was taking bath. He finds the Lord Vinayaka under disguise of a cowherd boy. As per the plan, when Vibishana is fully into water, Vinayaka takes the deity and keeps it firmly in sand, in the banks of kaveri. On seeing this, the angry Vibhishana chases the boy, to punish him, and boy keeps running and climbs over the rock near the Kaveri bank. Vibhishana finally reaches the boy and hits him on the fore-head. One can see a pit in the forehead of the idol even today. The little boy then reveals himself to be Vinayaka . Vibishana immediately apologizes and the Lord gives him his blessings, reveals that the idol is destined to remain in Srirangam and sends him off to Lanka.The place in which the Ranganathan deity was kept was later covered in deep forests, due to disuse and after a very long time, it was discovered when a Chola king chasing a parrot found the deity accidentally. He then established the Ranganathaswamy Temple, Srirangam as one of the largest temple complexes in the world. Meanwhile, the Pallavas built the Vinayaka temple and the Thayumanaswamy temple, in the rock which Vinayaka used to escape Vibishana.
Madhur Maha Ganapathi Temple

Madhur temple was originally Madhanentheswara (Shiva) Temple and as the lore goes, an old so called “low caste” lady “Madaru” discovered an “Udbhava Murthy” (a statue that was not made by a human) of shiva linga. The Ganapathy statue was drawn by a priest’s son, a small Brahmin boy, on the walls of the Garbhagriha(sanctum sanctorum) while playing. Day by day it became big and fat; so that the boy called Ganapathi as “boddajja” or “bodda ganesha”. The legend of Kumble seme says Tipu Sultan wanted to demolish the temple like Adooru Mahalingeswara temple during his invasion of Coorg, Tulunadu, and Malabar. But after drinking water from the well of the temple, he changed his mind on attacking and demolishing the Garbhagudi and marched towards Malabar.

Ashtavinayak or "eight Ganeshas" that became temples. . Ashtavinayaka they are in Maharashtra state of India that house eight distinct idols of Ganesh, in a pre-ascertained sequence. The Ashtavinayak yatra or pilgrimage covers the eight ancient holy temples of Ganesh which are situated around Pune. Each of these temples has its own individual legend and history, as distinct from each other as the murtis in each temple. The form of each murti of Ganesh and His trunk are distinct from one another.
Ballaleshwar Pali (Ashtavinayak)

In the village of Pali lived a successful businessman named Kalyan with his wife, Indumati. Their son, Ballal, and the other children in the village used to play puja, using stones in place of murtis. Once, the children, going to the outskirts of the village, saw a very large stone. At the insistence of Ballal, the children worshiped the stone as Ganesha. Led by Ballal, the children became so engrossed in their worship that they forgot about hunger and thirst; day and night.
Meanwhile, the parents of the village anxiously waited for their children to come home. When the children did not return on time, they all went to Kalyan's house and complained about his son Ballal. Kalyan, flying into a rage, took a stick and went in search of the children. Eventually, he found the children listening to the Ganesha Purana. In his fury, he destroyed the small temples built by the children, who fled away in terror, leaving Ballal by himself. Ballal, completely submerged in devotion to Ganesha, was grabbed by his father and beaten until blood drenched his clothes. His father proceeded to tie him to a tree and trampled on all the puja materials collected by the children. Lifting the large stone which the children had treated as Ganesha, he threw it to the ground, breaking it into pieces. He taunted Ballal, "Now we shall see which God protects you!" Going home, he left his own son bound to the tree to die.
Still bound to the tree, Ballal cursed his father for having insulted Ganesha, "May he become blind, deaf, dumb, and hunchbacked for his disrespect to the son of Parvati!" Though filled with pain, hunger, and thirst, he continued chanting the name of Ganesha until, exhausted, he fainted. On waking, Ballal entreated Ganesha to come to his aid. Lord Ganesha, moved by the child's devotion, appeared in the form of a sadhu before Ballal and untied him from the tree. On seeing Ganesha, Ballal's thirst and hunger vanished; his wounds were healed and he was completely invigorated. He prostrated before the sadhu, recognizing him as Ganesha, and worshipped him. Ganesha told Ballal he would bless him with whatever he asked for as a reward for his devotion. Ballal entreated, "May I be your unshakeable devotee, and may you always stay in this place and remove the miseries of the people who seek refuge in you." Ganesha said, "I shall ever remain here, and will take your name before mine, being worshiped as Ballal's Lord (BallalEshwar)." He embraced Ballal and vanished into the nearby stone. The stone's cracks disappeared and was made whole again.
That stone statue is called Ballaleshwar. The stone idol which Kalyan threw to the ground is also known as Dhundi Vinayak. This is a swayambhu murti and is worshiped before Ballaleshwar is worshiped.
Sorces :
- Ganesh, Studies of an Asian God (L.Brown)
- https://en.wikipedia.org/wiki/Ashtavinayaka
- https://www.wordzz.com/top-10-must-visit-ganesha-temples/