Observations of gamma-ray bursts by the Fermi satellite, capable of detecting photons in a very broad energy band: 8 keV to >300 GeV, have opened a new window for the study of these enigmatic explosions. It is widely assumed that photons of energy larger than 100 MeV are produced by the same source that generated lower energy photons – at least whenever the shape of the spectrum is a Band function. We report here a surprising result – the Fermi data for a bright burst, GRB 080916C, unambiguously shows that the high-energy photons (≳102 MeV) were generated in the external shock via the synchrotron process, and the lower energy photons had a distinctly different source. The magnetic field in the region where high-energy photons were produced (and also the late-time afterglow emission region) is found to be consistent with shock compressed magnetic field of the circum-stellar medium. This result sheds light on the important question of the origin of magnetic fields required for gamma-ray burst afterglows. The external shock model for high-energy radiation makes a firm prediction that can be tested with existing and future observations.