Here are Krishna’s words (said to Arjuna) from the Baghvat Gita (Ch 4, verse 7):
“Whenever (in every age) there is a decline of dharma (or righteousness) and the rise of unrighteousness, I send myself forth (or manifest myself)”
Meaning - whenever there is a rise in unrighteousness, God incarnates as man on earth.
There are many recognized incarnations of God, Rama and Krishna are the most popularly worshipped ones today. They are all supposed to be incarnations of Vishnu, the preserver/sustainer, the second of the three main Hindu Gods (Some Hindus recognize the Buddha as well as Jesus as similar incarnations. )