The blind King Dhritarashtra asks Sanjaya to recount to him what happened when his family the Kauravas gathered to fight the Pandavas for control of Hastinapura. His family isn't the rightful heir to the kingdom, but they have assumed control, and Dhritarashtra is trying to preserve it for his son Duryodhana. Sanjaya tells of Arjuna, who has come as leader of the Pandavas to take back his kingdom, with Sri Krishna as his charioteer. The Gita is the conversation between Krishna and Arjuna leading up to the battle.
Arjuna doesn't want to fight. He doesn't understand why he has to shed his family's blood for a kingdom that he doesn't even necessarily want. In his eyes, killing his evil and killing his family is the greatest sin of all. He casts down his weapons and tells Krishna he will not fight. Krishna, then, begins the systematic process of explaining why it is Arjuna's dharmic duty to fight and how he must fight in order to restore his karma.
Krishna first explains the samsaric cycle of birth and death. He says there is no true death of the soul -- simply a sloughing of the body at the end of each round of birth and death. The purpose of this cycle is to allow a person to work off their karma, accumulated through lifetimes of action. If a person completes action selflessly, in service to God, then they can work off their karma, eventually leading to a dissolution of the soul, the achievement of enlightenment and vijnana, and an end to the samsaric cycle. If they act selfishly, then they keep accumulating debt, putting them further and further into karmic debt.
Krishna presents three main concepts for achieving this dissolution of the soul -- renunciation, selfless service, and meditation. All three are elements for achieving 'yoga,' or skill in action. Krishna says that the truly divine human does not renounce all worldly possessions or simply give up action, but rather finds peace in completing action in the highest service to God. As a result, a person must avoid the respective traps of the three gunas: rajas (anger, ego), tamas (ignorance, darkness), and saatva (harmony, purity).
The highest form of meditation comes when a person not only can free themselves from selfish action, but also focus entirely on the divine in their actions. In other words, Krishna says that he who achieves divine union with him in meditation will ultimately find freedom from the endless cycle of rebirth and death. He who truly finds union with God will find him even at the moment of death.
Arjuna stills seem to need evidence of Krishna's divine powers, so Arjuna appears to him in his powerful, most divine form, with the "power of one thousand suns." Seeing Krishna in his divine state, Arjuna suddenly realizes what enlightenment can bring him in union, and he now completely has faith in the yogic path. He goes on to ask Krishna how he can receive the love of God, and Krishna reveals that love comes from a person's selfless devotion to the divine, in addition to an understanding that the body is simply ephemeral -- a product of prakriti, emerging from purusha, and is subject to endless rebirth. A person must let go of their body's cravings and temptations and aversions to find freedom.
The Gita ends with Krishna telling Arjuna he must choose the path of good or evil, as it his his duty to fight the Kauravas for his kingdom. In that, he is correcting the balance of good and evil, fulfilling his dharma, and offering the deepest form of selfless service. Arjuna understands and, with that, proceeds into battle.