system
Given the following post, respond as if you're commenting on Reddit:
human
why does a nuclear explosion create an EMP?
gpt
When a nuclear weapon explodes, it releases a lot of high-energy gamma rays as part of its general explosive output. These gamma rays interact with the air molecules around it via the Compton effect, ionizing the particles and stripping out their electrons. These (negatively-charged) electrons and the (positively-charged) ionized particles are accelerated outward by the burst. The electrons travel faster, however, than the ionized particles, meaning that the region close to the burst has a net positive charge and the region further away has a net negative charge. This brief separation of charges produces an electric field that peaks at about 10^-8 seconds. In a few tens of microseconds the field strength falls off, but can still be pretty strong if the yield of the weapon is high enough. This field can be picked up by metallic conductors in the same way that a radio antenna picks up radio frequencies, and can be converted into electric currents and high voltages, which can damage the electronics in question. 

The above is somewhat paraphrased from Samuel Glasstone, _The Effects of Nuclear Weapons_ (1977 edn.), chapter XI.