The Bhagavad-gītā states that one should perform one’s duty. In the case of Arjuna, his duty as a kṣatriya (warrior) was to fight. Arjuna felt compassion for his enemies, and desired to abandon his duty as a kṣatriya. Kṛṣṇa however, explained to him that due to the immorality of the opposing side, Arjuna’s pity for them was misplaced and that their fate was already sealed. You can learn more about this in Bhagavad-gītā Chapter 2 – Sāṅkhya Yoga (The Yoga of Analysis)