https://www.sacred-texts.com/hin/m01/m01066.htm
"Vaisampayana said, 'Then Indra had a consultation with Narayana about the latter's descent on the earth from heaven with all the gods according to their respective parts. And, having commanded all the dwellers in heaven, Indra returned from the abode of Narayana. And the dwellers in heaven gradually became incarnate on earth for the destruction of the Asuras and for the welfare of the three worlds. And then, O tiger among kings, the celestials had their births, according as they pleased, in the races of Brahmarshis and royal sages. And they slew the Danavas, Rakshasas, Gandharvas and Snakes, other man-eaters, and many other creatures. And, O bull in the Bharata race, the Danavas, Rakshasas and Gandharvas and Snakes, could not slay the incarnate celestials even in their infancy, so strong they were.'
The Mahabharata war was a divine purpose to lighten the burden of earth and to slay asuras born in world of men for the welfare of the three worlds.
"And the earth, thus oppressed by the mighty Asuras endued with great strength and energy and possessed of abundant means, began to think of waiting on Brahman. The united strength of the creatures (such as Sesha, the Tortoise, and the huge Elephant), and of many Seshas too, became capable of supporting the earth with her mountains, burdened as she was with the weight of the Danavas.
This is why gods started to incarnate on earth.
"And, O bull of the Bharata race, when such was the blessed state of the terrestrial world, the Asuras, O lord of men, began to be born in kingly lines. And the sons of Diti (Daityas) being repeatedly defeated in war by the sons of Aditi (celestials) and deprived also of sovereignty and heaven, began to be incarnated on the earth. And, O king, the Asuras being possessed of great powers, and desirous of sovereignty began to be born on earth amongst various creatures, such as kine, horses, asses, camels, buffaloes, among creatures such as Rakshasas and others, and among elephants and deer. And, O protector of the earth, owing to those already born and to those that were being born, the earth became incapable of supporting herself. And amongst the sons of Diti and of Danu, cast out of heaven, some were born on the earth as kings of great pride and insolence. Possessed of great energy, they covered the earth in various shapes. Capable of oppressing all foes, they filled the earth having the ocean for its boundaries. And by their strength they began to oppress Brahmanas and Kshatriyas and Vaisyas and Sudras and all other creatures also. Terrifying and killing all creatures, they traversed the earth, O king, in bands of hundreds and thousands. Devoid of truth and virtue, proud of their strength, and intoxicated with (the wine of) insolence, they even insulted the great Rishis in their hermitages.
The asuras born on men started wreaking havoc on earth.
The earth was burdened by the weight of danavas.
Duryodhana and others such as Jarasandha were demons born on earth.
https://www.sacred-texts.com/hin/m01/m01068.htm
The first of Danavas, who was known by the name of Viprachitti, became that bull among men, noted as Jarasandha. And, O king, that son of Diti, who was known as Hiranyakasipu, was known in this world among men as the powerful Sisupala. He who had been known as Samhlada, the younger brother of Prahlada, became among men the famous Salya, that bull amongst Valhikas. The spirited Anuhlada who had been the youngest became noted in the world as Dhrishtaketu.
The evil-minded and wicked king Duryodhana, the destroyer of the fair fame of the Kurus, was born of a portion of Kali on earth. He it was who caused all creatures to be slain and the earth to be wasted; and he it was who fanned the flame of hostility that ultimately consumed all. They who had been the sons of Pulastya (the Rakshasas) were born on earth among men of Duryodhana's brothers, that century of wicked individuals commencing with Duhasasana as their first. And, O bull among the Bharata princes, Durmukha, Duhsaha, and others whose names I do not mention, who always supported Duryodhana (in all his schemes), were, indeed, the sons of Pulastya.
The Kauravas were portions of Danavas who repeatedly got defeated in war by Aditi's son and started to torture the earth by wreaking havoc and the Pandavas, Karna, Dhrishtadyumna and others such as Drupada, Virata, Kritavarma, Bhishma, Drona were portions of gods.
And, O king, know thou that Kama--the first of all exalted men--the foremost of all wielders of weapons--the slayer of foes--and the best portion of the maker of day--was the friend and counsellor of Duryodhana. And a portion of Sri herself became incarnate on earth, for the gratification of Narayana, in the line of Bhishmaka. And she was by name the chaste Rukmini. And the faultless Draupadi, slender-waisted like the wasp, was born of a portion of Sachi (the queen of the celestials), in the line of Drupada.
"And, O monarch, learn that king Yudhishthira was a portion of Dharma; that Bhimasena was of the deity of wind; that Arjuna was of Indra, the chief of the celestials; and that Nakula and Sahadeva, the handsomest beings among all creatures, and unrivalled for beauty on earth, were similarly portions of the twin Aswins.
Krishna was the portion of Narayana himself and Balarama was Shesha naga.
And he, called Vasudeva, endued with great valour, was among men a portion of him called Narayana--the god of gods--eternal. And Valadeva of exceeding strength was a portion of the Naga, Sesha.
And they all having resolved to come down on earth in their respected parts, then went to Narayana, the slayer of all foes, at Vaikunth--the one who has the discus and the mace in his hands, who is clad in purple, who is of great splendour, who hath the lotus on his navel, who is the slayer of the foes of the gods, who is of eyes looking down upon his wide chest (in yoga attitude), who is the lord of the Prajapati himself, the sovereign of all the gods, of mighty strength, who hath the mark of the auspicious whirl on his breast, who is the mover of every one's faculties and who is adored by all the gods. Him, Indra the most exalted of persons, addressed, saying, "Be incarnate." And Hari replied,--'Let it be.'"
https://www.sacred-texts.com/hin/m01/m01065.htm
Narayana was the one who said that the gods should incarnated on earth. So Vasudeva, born of his portion let the war to take place.
Vyasa also says that Krishna can change the very course of creation but he let the war to happen.
Krishna suffered it to take place although he was fully competent to baffle it. Govinda was able to alter the very course of the universe with all its mobile and immobile creatures. What need then be said of the curse of even high-souled Brahmanas? He who used to proceed in front of thy car, armed with discus and mace, through affection for thee, was the four-armed Vasudeva, that ancient rishi. That high-souled one of expansive eyes, Krishna, having lightened the burthen of the Earth and cast off his (human) body, has attained to his own high seat. By thee also, O foremost of men, with Bhima for thy helpmate and the twins, O mighty-armed hero, has the great work of the gods been accomplished. O foremost one of Kuru’s race, I regard thee and thy brothers as crowned with success, for ye have accomplished the great purpose of your lives.