Drona was an exceptional fighter in the Mahabharata war and was unkillable on the battlefield. So to kill him, Krishna told the Pandavas to lie that Drona's son, Ashvattama, was killed, so that Drona would stop fighting and Drishtyadumna would kill Drona. Krishna says:
This foremost of all bowmen is incapable of being ever vanquished by force in battle, by the very gods with Vasava at their head. When, however, he lays aside his weapons, he becomes capable of being slain on the field even by human beings. Casting aside virtue, ye sons of Pandu, adopt now some contrivance for gaining the victory, so that Drona of the golden car may not slay us all in battle. Upon the full of (his son) Aswatthaman he will cease to fight, I think. Let sonic man, therefore, tell him that Aswatthaman, hath been slain in battle.
In that same passage, Krishna also says that lying in such a situation is not a sin, and advises Yudhishthira to lie to Drona:
"Meanwhile, O monarch, Govinda, knowing that Drona, that foremost of warriors, was capable of sweeping all the Pandavas off the face of the earth, became much distressed. Addressing Yudhishthira he said, 'If Drona fighteth, filled with rage, for even half-a-day, I tell thee truly, thy army will then be annihilated. Save us, then, from Drona. under such circumstances, falsehood is better than truth. By telling an untruth for saving a life, one is not touched by sin. There is no sin in untruth spoken unto women, or in marriages, or for saving king, or for rescuing a Brahmana.'
The Pandavas listened to Krishna's advice and lied to Drona that his son died.
However, after the war was over, the Pandavas were punished for this specific act of deception and were punished for this sin by experiencing an illusion of hell! This is what Yama told Yudhishthira in hell:
O son of Pritha, thy brothers, O king, were not such as to deserve Hell. All this has been an illusion created by the chief of the gods.
Thou hadst, by a pretence, deceived Drona in the matter of his son. Thou hast, in consequence thereof, been shown Hell by an act of deception. After the manner of thyself, Bhima and Arjuna, and Draupadi, have all been shown the place of sinners by an act of deception.
The question is, why would Krishna, the supreme Brahman, tell the Pandavas to lie, and then punish them for it!?