Stars erupt with flares for the same reason the sun does. Around active regions of the star's atmosphere, magnetic fields become twisted and distorted. Much like winding up a rubber band, these allow the fields to accumulate energy. Eventually a process called magnetic reconnection destabilizes the fields, resulting in the explosive release of the stored energy we see as a flare. The outburst emits radiation across the electromagnetic spectrum, from radio waves to visible, ultraviolet and X-ray light.
At 5:07 p.m. EDT on April 23, the rising tide of X-rays from DG CVn's superflare triggered Swift's Burst Alert Telescope (BAT). Within several seconds of detecting a strong burst of radiation, the BAT calculates an initial position, decides whether the activity merits investigation by other instruments and, if so, sends the position to the spacecraft. In this case, Swift turned to observe the source in greater detail, and, at the same time, notified astronomers around the globe that a powerful outburst was in progress.
Read the full story at nasa.gov