Eighth section of Shri Ganesha Purana mentions these eight incarnations of Ganapati, which defeated the eight vices in the form of fierce demons.
1. Vakratunda
This incarnation of Ganapati defeated the demon Matsarasura, born from the envy of Indra. Worshipping this form of Ganapati protects the devotees from jealousy.
2. Ekadanta
Ganapati defeated the demon Madasura created by Rishi Chyavana. This form is Ganapati is worshipped to be from ego.
3. Mahodara
Ganapati took the form of Mahodara to defeat the demon Mohasura. This form of Ganapati keeps us free from worldly attachments.
4. Gajanana
Lobhasura born from Kubera was suppressed by Gajanana form of Ganapati. Ganapati in His Gajanana form frees us from greed.
5. Lambodara
When Mahadeva's anger resulted into the birth of Krodhasura, Ganapati took the form of Lambodara to suppress this fierce demon. This form of Ganapati keeps devotees free from anger.
6. Vikata
When Bhagwan Vishnu created the demon Kamasura, Ganapati took the form of Vikata to suppress him. If you are suffering from worldly desires, this form of Ganapati protects us from them.
7. Vighnaraja
When devi Parvati's laughter resulted into creation of Mamatasura who under the influence of Shambharasura started tormenting people, Ganapati took the form of Vighnaraja to defeat Mamatasura and bring him back on the path of Dharma.
8. Dhumravarna
When Sun's pride resulted into the birth of demon Ahantasura, Ganapati took the form of Dhumravarna to suppress this demon. Worshipping Dhumravarna form of Ganapati suppresses your pride and arrogance.
This eight forms of Ganapati, collectively called Ashtavinayak are worshipped to keep us free from eight vices namely, envy, ego, attachment, greed, anger, desire, obsession and pride.