B and V time-series photometry of the M31 dwarf spheroidal satellite Andromeda XXI ( And XXI ) was obtained with the Large Binocular Cameras at the Large Binocular Telescope . We have identified 50 variables in And XXI , of which 41 are RR Lyrae stars ( 37 fundamental-mode - RRab , and 4 first-overtone - RRc , pulsators ) and 9 are Anomalous Cepheids ( ACs ) . The average period of the RRab stars ( \langle Pab \rangle = 0.64 days ) and the period-amplitude diagram place And XXI in the class of Oosterhoff II - Oosterhoff-Intermediate objects . From the average luminosity of the RR Lyrae stars we derived the galaxy distance modulus of ( m-M ) _ { 0 } = 24.40 \pm 0.17 mag , which is smaller than previous literature estimates , although still consistent with them within 1 \sigma . The galaxy color-magnitude diagram shows evidence for the presence of three different stellar generations in And XXI : 1 ) an old ( \sim 12 Gyr ) and metal poor ( [ Fe/H ] = - 1.7 dex ) component traced by the RR Lyrae stars ; 2 ) a slightly younger ( 10-6 Gyr ) and more metal rich ( [ Fe/H ] = - 1.5 dex ) component populating the red horizontal branch , and 3 ) a young age ( \sim 1 Gyr ) component with same metallicity , that produced the ACs . Finally , we provide hints that And XXI could be the result of a minor merging event between two dwarf galaxies .