Answer:
As you light the candle, the region of the candle near the flame suffers an increase in energy, caused by the heat of the flame. As you know, when we give enough heat to a solid, it will change of phase, from solid to liquid, and this is why the candle melts.