I want to know the reason why Brahma asked Vyasa to write Mahabarata.
Lord Brahma had not asked Maharshi Vyasa to write Mahabharata. Maharshi Vyasa by his penance analysed all Vedas and also composed Mahabharta. But he had a doubt that by what means he can present that holy history to mankind. Seeing Vyasa in dilemma, Lord Brahma came there and suggested that Lord Ganesha can help him in writing the Epic. So Maharshi Vyasa, meditated upon Lord Ganesha and Lord Ganesha pleased by him, wrote The Great Epic Mahabharata. This story is mentioned in Mahabharata, Adi Parva, Section 1.
The son of Satyavati having, by penance and meditation, analysed the eternal Veda, afterwards composed this holy history, when that learned Brahmarshi of strict vows, the noble Dwaipayana Vyasa, offspring of Parasara, had finished this greatest of narrations, he began to consider how he might teach it to his disciples. And the possessor of the six attributes, Brahma, the world's preceptor, knowing of the anxiety of the Rishi Dwaipayana, came in person to the place where the latter was, for gratifying the saint, and benefiting the people. And when Vyasa, surrounded by all the tribes of Munis, saw him, he was surprised; and, standing with joined palms, he bowed and ordered a seat to be brought. And Vyasa having gone round him who is called Hiranyagarbha seated on that distinguished seat stood near it; and being commanded by Brahma Parameshthi, he sat down near the seat, full of affection and smiling in joy. Then the greatly glorious Vyasa, addressing Brahma Parameshthi, said, "O divine Brahma, by me a poem hath been composed which is greatly respected. The mystery of the Veda, and what other subjects have been explained by me; the various rituals of the Upanishads with the Angas; the compilation of the Puranas and history formed by me and named after the three divisions of time, past, present, and future; the determination of the nature of decay, fear, disease, existence, and non-existence, a description of creeds and of the various modes of life; rule for the four castes, and the import of all the Puranas; an account of asceticism and of the duties of a religious student; the dimensions of the sun and moon, the planets, constellations, and stars, together with the duration of the four ages; the Rik, Sama and Yajur Vedas; also the Adhyatma; the sciences called Nyaya, Orthœphy and Treatment of diseases; charity and Pasupatadharma; birth celestial and human, for particular purposes; also a description of places of pilgrimage and other holy places of rivers, mountains, forests, the ocean, of heavenly cities and the kalpas; the art of war; the different kinds of nations and languages; the nature of the manners of the people; and the all-pervading spirit;--all these have been represented. But, after all, no writer of this work is to be found on earth.'
"Brahma said. 'I esteem thee for thy knowledge of divine mysteries, before the whole body of celebrated Munis distinguished for the sanctity of their lives. I know thou hast revealed the divine word, even from its first utterance, in the language of truth. Thou hast called thy present work a poem, wherefore it shall be a poem. There shall be no poets whose works may equal the descriptions of this poem, even, as the three other modes called Asrama are ever unequal in merit to the domestic Asrama. Let Ganesha be thought of, O Muni, for the purpose of writing the poem.'
"Sauti said, 'Brahma having thus spoken to Vyasa, retired to his own abode. Then Vyasa began to call to mind Ganesha. And Ganesha, obviator of obstacles, ready to fulfil the desires of his votaries, was no sooner thought of, than he repaired to the place where Vyasa was seated. And when he had been saluted, and was seated, Vyasa addressed him thus, 'O guide of the Ganas! be'est thou the writer of the Bharata which I have formed in my imagination, and which I am about to repeat."
"Ganesha, upon hearing this address, thus answered, 'I will become the writer of thy work, provided my pen does not for a moment cease writing." And Vyasa said unto that divinity, 'Wherever there be anything thou dost not comprehend, cease to continue writing.' Ganesha having signified his assent, by repeating the word Om! proceeded to write; and Vyasa began; and by way of diversion, he knit the knots of composition exceeding close; by doing which, he dictated this work according to his engagement.