Krishna had said he would not fight, but he did agree to be Arjuna's charioteer, and so he drove Arjuna out onto the battlefield.
When Arjuna saw the enemy lines filled with kinsmen and friends whom he loved, Drona and Bhishma and many others, he fell to his knees in despair.
"I cannot fight this war," he moaned.
Krishna then lectured Arjuna about duty and about the yoga of action; this was the Bhagavad-Gita. "Seek not the fruits of action," Krishna said, "but you must act, Arjuna! You are a kshatriya, and now you must fight. This is your dharma."