We use a cosmological simulation of the formation of the Local Group to explore the origin of age and metallicity gradients in dwarf spheroidal galaxies. We find that a number of simulated dwarfs form "outside-in", with an old, metal-poor population that surrounds a younger, more concentrated metal-rich component, reminiscent of dwarf spheroidals like Sculptor or Sextans. We focus on a few examples where stars form in two populations distinct in age in order to elucidate the origin of these gradients. The spatial distributions of the two components reflect their diverse origin; the old stellar component is assembled through mergers, but the young population forms largely in situ. The older component results from a first episode of star formation that begins early but is quickly shut off by the combined effects of stellar feedback and reionization. The younger component forms when a late accretion event adds gas and reignites star formation. The effect of mergers is to disperse the old stellar population, increasing their radius and decreasing their central density relative to the young population. We argue that dwarf-dwarf mergers offer a plausible scenario for the formation of systems with multiple distinct populations and, more generally, for the origin of age and metallicity gradients in dwarf spheroidals.