Thorne–Żytkow objects (TŻOs), originally proposed by Thorne and Żytkow, may form as a result of unstable mass transfer in a massive X-ray binary after a neutron star (NS) is engulfed in the envelope of its companion star. Using a rapid binary evolution program and the Monte Carlo method, we simulated the formation of TŻOs in close binary stars. The Galactic birth rate of TŻOs is about $$1.5\times 10^{-4}~\hbox {yr}^{-1}$$ 1.5×10-4yr-1 . Their progenitors may be composed of a NS and a main-sequence star, a star in the Hertzsprung gap or a core-helium burning, or a naked helium star. The birth rates of TŻOs via the above different progenitors are $$1.7\times 10^{-5}$$ 1.7×10-5 , $$1.2\times 10^{-4}$$ 1.2×10-4 , $$0.7\times 10^{-5}$$ 0.7×10-5 , $$0.6\times 10^{-5}~\hbox {yr}^{-1}$$ 0.6×10-5yr-1 , respectively. These progenitors may be massive X-ray binaries. We found that the observational properties of three massive X-ray binaries (SMC X-1, Cen X-3 and LMC X-4) in which the companions of NSs may fill their Roche robes were consistent with those of their progenitors.