The answer to 'why is my junction box sparking' is that a sparking junction box is a serious electrical issue that requires immediate attention. Potential causes include loose connections, damaged wiring, water intrusion, or a short circuit. This can be a fire hazard, so it's important to address the problem right away.
If you notice sparking or arcing coming from your junction box, shut off power to the area immediately and do not attempt to open or work on the box yourself. Sparking is a sign of an active electrical problem that could be dangerous. Call a licensed electrician to diagnose and repair the issue as soon as possible.