The remaining inventory of X phones, other than those not required for replacements, will still be sold -- either through carriers, Best Buy, or Ebay. I'm sure they don't have too many left in the pipeline, since they likely quit building the X a few months ago (when they started changing over for Xs/Max production).
As for why, I believe it mostly has to do with some of the parts on the X -- the X used a Samsung OLED panel and the CDMA phones used a Qualcomm modem. The Xs phones are now using LG OLED panels and Intel modems; I suspect the major reason for discontinuing the X is so they didn't have to keep buying those parts.