Headlight trouble

the electrical plug to my headlight melted on one side now my left headlight wont work what caused this

A poor contact.  A bad contact creates more heat.  It also could be a non-standard lamp like some of the extra bright lamps being sold today.