Cygnus X-2 appears to be the descendant of an intermediate-mass X-ray binary (IMXB). Using Mazzitelli's stellar code we compute detailed evolutionary sequences for the system and find that its prehistory is sensitive to stellar input parameters, in particular the amount of core overshooting during the main-sequence phase. With standard assumptions for convective overshooting a case B mass transfer starting with a 3.5-M⊙ donor star is the most likely evolutionary solution for Cygnus X-2. This makes the currently observed state rather short-lived, of order 3 Myr, and requires a formation rate > 10−7–10−6 yr−1 of such systems in the Galaxy. Our calculations show that neutron star IMXBs with initially more massive donors (≳4 M⊙) encounter a delayed dynamical instability; they are unlikely to survive this rapid mass transfer phase. We determine limits for the age and initial parameters of Cygnus X-2 and calculate possible dynamical orbits of the system in a realistic Galactic potential, given its observed radial velocity. We find trajectories which are consistent with a progenitor binary on a circular orbit in the Galactic plane inside the solar circle that received a kick velocity ≤200 km s−1 at the birth of the neutron star. The simulations suggest that about 7 per cent of IMXBs receiving an arbitrary kick velocity from a standard kick velocity spectrum would end up in an orbit similar to Cygnus X-2, while about 10 per cent of them reach yet larger Galactocentric distances.