The emission of supernova remnants reflects the properties of both the progenitor supernovae and the surrounding environment . The complex morphology of the remnants , however , hampers the disentanglement of the two contributions . Here we aim at identifying the imprint of SN 1987A on the X-ray emission of its remnant and at constraining the structure of the environment surrounding the supernova . We performed high-resolution hydrodynamic simulations describing SN 1987A soon after the core-collapse and the following three-dimensional expansion of its remnant between days 1 and 15000 after the supernova . We demonstrated that the physical model reproducing the main observables of SN 1987A during the first 250 days of evolution reproduces also the X-ray emission of the subsequent expanding remnant , thus bridging the gap between supernovae and supernova remnants . By comparing model results with observations , we constrained the explosion energy in the range 1.2 - 1.4 \times 10 ^ { 51 } erg and the envelope mass in the range 15 - 17 M _ { \odot } . We found that the shape of X-ray lightcurves and spectra at early epochs ( < 15 years ) reflects the structure of outer ejecta : our model reproduces the observations if the outermost ejecta have a post-explosion radial profile of density approximated by a power law with index \alpha = -8 . At later epochs , the shapes of X-ray lightcurves and spectra reflect the density structure of the nebula around SN 1987A . This enabled us to ascertain the origin of the multi-thermal X-ray emission , to disentangle the imprint of the supernova on the remnant emission from the effects of the remnant interaction with the environment , and to constrain the pre-supernova structure of the nebula .