If Lord Krishna was able to prevent the Kurukshetra war, why did he allow the war to take place and happen which resulted the deaths of thousands of people?
Utanka asks the same question to Krishna in the Ashwamedha parva of Mahabharata -
Utanka said,--'Since, though able, O Krishna, thou didst not rescue those foremost ones of Kuru's race, who were thy relatives and, therefore, dear to thee, I shall, without doubt, curse thee. Since thou didst not forcibly compel them to forbear, therefore, O slayer of Madhu, I shall, filled with wrath, denounce a curse on thee. It seems, O Madhava, that though fully able (to save them), thou wert indifferent to these foremost of Kurus who, overwhelmed by insincerity and hypocrisy have all met with destruction.'
Here is a portion of Krishna's reply -
I am the origin and I am the destruction of all things. I am the creator of all existent objects and I am their destroyer. Knowing no change myself, I am the destroyer of all those creatures that live in sinfulness. In every Yuga I have to repair the causeway of Righteousness, entering into diverse kinds of wombs from desire of doing good to my creatures. When, O son of Bhrigu's race, I live in the order of the deities, I then verily act in every respect as a deity. When I live in the order of the Gandharvas, I then, O son of Bhrigu's race, act in every respect as a Gandharva. When I live in the order of the Nagas, I then act as a Naga, and when I live in the order of Yakshas or that of Rakshasas, I act after the manner of that order. Born now in the order of humanity, I must act as a human being. I appealed to them (the Kauravas) most piteously. But stupefied as they were and deprived of their senses, they refused to accept my words. I frightened them, filled with wrath, referring to some great fear (as the consequence of their slighting my message). But once more I showed themselves my usual (human) form. Possessed as they were of unrighteousness, and assailed by the virtue of Time, all of them have been righteously slain in battle, and have, without doubt, gone to Heaven.