The story is a bit mixed as to how he died, complicated by a clear edit to the Bayeux Tapestry. The common legend has it that he was hit in the eye by an arrow at Hastings, but ritual blinding was a relatively common punishment for oathbreakers and particularly treacherous nobles during the Anglo-Saxon period so this may well have been an added propaganda element given that William's invasion was predicated on Harold's purported oathbreaking. Other elements state that Harold and his retinue were overcome by a cavalry charge and cut down by Norman knights.
As to why he died comes down essentially to the different combat tactics of the Normans and Anglo-Saxons and the command and control issues this posed. William, notably, fought on horseback. This meant that when, during the battle, word spread that he had been killed and elements of his army began to rout, he could quickly respond in person and rally his forces. Harold, on the other hand, was likely fighting on foot, leading his men directly as custom demanded. This meant that when a flank of the English formation broke ranks to charge after withdrawing Normans, thus disrupting the previously impregnable shield-wall, Harold was conversely unable to respond quickly and restore order to his line.