  Four significant events of rapid $^{14}$C increase have taken place within
the past several thousand years. The physical origin of these rapid increases
is still a mystery but must be associated with extremely energetic cosmic
processes. Pulsars are highly magnetized neutron stars that emit a beam of
electromagnetic radiations. Any sudden release of the energy stored in the
magnetic multipole field will trigger outbursts similar to the giant flares of
magnetars. Here we show that the relativistic outflow from the outbursts of a
nearby pulsar interacting with the interstellar medium generates a shock, which
accelerates electrons to trillions of electron volts. The high-energy photons
from synchrotron emission of the shock interact with Earth's atmosphere,
producing the cosmogenic nuclide $^{14}$C, which can cause the rapid $^{14}$C
increases discovered in tree rings. These same relativistic electrons can
account for a significant fraction of the cosmic electron spectrum in the
trillion electron volts energy range, as observed by space-borne satellites.
Since these outburst events can significantly affect our environment,
monitoring nearby pulsars for such outbursts may be important in the future.
