This happened because Voldemort was using the Elder Wand, which was rightfully Harry's (Malfoy got the wand from Dumbledore and Harry defeated Malfoy in a battle, winning the wand's allegiance to himself).
As we know, a wand can't truly hurt its true master. So when Voldemort and Harry simultaneously cast spells (the Elder Wand recognises Harry as its owner and) the Killing Curse Voldemort had cast rebounces on Harry's Defensive Spell and kills him instead.