BG 4.7
यदा यदा हि धर्मस्य ग्लानिर्भवति भारत
अभ्युत्थानमधर्मस्य तदात्मानं सृजाम्यहम्
yadā yadā hi dharmasya glānirbhavati bhārata
abhyutthānamadharmasya tadātmānaṃ sṛjāmyaham
TRANSLATION
Whenever there is a decline of Dharma, O Arjuna, and uprising of Adharma, then I incarnate Myself.
PURPORT
There is no restriction as to the time of My birth; whenever the Dharma taught by the Vedas that must be observed according to the arrangements of the four stations and the four stages of life declines, and Adharma, its opposite, increases, then I Myself, by My own will and in the manner stated, incarnate Myself.
Shri Krishna gives the purpose of His birth.