In the earlier verses, Shri Krishna glorifies the knowledge he has given to Arjuna thus far telling him that he has given the same knowledge to the Sun God who has given it to Manu. Manu gave it to Ikshvaku, Ikshvaku to Nimi, and so on. It was passed down from one king to another as a tradition to a lineage of kings. Over time the knowledge got lost because it went to people who were not fit students with their own shortcomings and couldn’t transfer it in the true essence.
Arjuna then asked Shri Krishna how he is to understand when Shri Krishna says he taught Vivasvan. Vivasvan was there from the beginning of time, but Shri Krishna is almost the same age as Arjuna.
Chapter 4, Verse 5
बहूनि मे व्यतीतानि जन्मान तव चार्जुन ।
तान्यहं वेद सर्वाणि न त्वं वेत्थ परन्तप ॥५॥
bahūni me vyatītāni janmāni tava cārjuna,
tānyahaṁ veda sarvāṇi na tvaṁ vettha parantapa. (5)
The Supreme Lord said: Both you and I have had many births, O Arjuna. I remember them all but you do not know them O Parantapa (scorcher of foes).
Shri Krishna says that he, Arjuna, and everyone else had many embodiments before this present embodiment. But the difference is that Shri Krishna remembers all the births but Arjuna does not.
Who we are today is not accidental. We all had many many lives before this. Through this present body and environment, we are exhausting all our past tendencies (physical, emotional, and mental) that we have accumulated over many births. We are all constantly moving toward a direction to fulfill some desire or the other. We cannot fulfill all our desires in one life because of physical limitations or because of the environment, so we seek out a new body.
Chapter 4, Verse 6
अजोऽपि सन्नव्ययात् भूतानामीश्वरोऽप सन् ।
प्रकृतिं स्वामधिष्ठाय सम्भवाम्यात्ममायया ॥६॥
ajo’pi sannavyayātmā bhūtānāmīśvaro’pi san,
prakṛtiṁ svāmadhiṣṭhāya sambhavāmyātmamāyayā. (6)
Although I am unborn, am the Lord of all beings, and am of imperishable nature, yet, ruling over My own nature, I take birth by My own Maya.
Birth is to gain a body for the expression of the mind to exhaust past tendencies (vāsanās). Decay of the body is death.
The Lord has no past tendencies to exhaust. He is changeless, unborn (unconditioned by time), and imperishable. Shri Krishna explains that even though he is the Lord of all beings, he manifests as a form into the world with his own creative potential (power of Māya). Therefore he knows all his past embodiments and we do not.
Chapter 4, Verse 7
यदा यदा हि धर्मस्य ग्लानिर्भवति भारत ।
अभ्युत्थानमधर्मस्य तदात्मानं सृजाम्यहम् ॥७॥
yadā yadā hi dharmasya glānirbhavati bhārata,
abhyutthānamadharmasya tadātmānaṁ sṛjāmyaham. (7)
Whenever there is a decline in righteousness, O Bharata (Arjuna), and an increase in unrighteousness, at that time I manifest Myself.
The next question that may arise in our mind is, when does the Lord project himself into the world?
Whenever there is a decline in good/righteousness and unrighteousness is on the rise, then the Lord manifests as a form in the world (avatāra). He becomes a part of our world to teach and show us the path to evolve.
Chapter 4, Verse 8
परित्राणाय साधूनां विनाशाय च दुष्कृताम् ।
धर्मसंस्थापनार्थाय सम्भवामि युगे युगे ॥८॥
paritrāṇāya sādhūnāṁ vināśāya ca duṣkṛtām,
dharmasaṁsthāpanārthāya sambhavāmi yuge yuge. (8)
To protect the good, to destroy the wicked, and to reestablish righteousness I am born age after age.
From time to time the path of evolution gets blocked by the atrocities of the wicked and the cruel. And at that time Shri Krishna says he manifests as a form to protect the good and to reestablish righteousness by destroying the unrighteous.
Manifestation of the Lord can happen in any form to pave the way for cultural or evolutionary revival. This happens in cycles in the flow of time.