Why Lm317 burnout and the potentiometer sparks?
If your pot is of poor quality, any wiper break will cause a sudden high resistance that will have unfortunate consequences to the constant current driver in the regulator. Voltage on the wiper will spike to full input voltage and the output voltage will also spike at full on. 

Use a better pot and add a capacitor across it as indicated in the spec sheet. 



Even then, I would be tempted to add a fixed resistor across the pot so you know what the worst case will be if the wiper loses contact, or as Peter mentioned, wire the pot as shown below so the body of the pot is always presenting a resistance when the wiper breaks contact.