Your get the basic intuition, but real-life situation is a bit different.
First, I didn't really understand what you meant by "try to catch some 'fool'", but what you are calling foreign exchange bank is actually called the Foreign Exchange (market), and consist of buyers and sellers that are basically ready to buy and sell any currencies (almost all currencies in fact) provided that the price aligns with their expectations. Classic laws of market apply to this market, and if X's government (its central bank to be more precise) prints a lot of money, money supply increases. The result is a decrease in the price of money relative to other money, which is the exchange rate.
Money may be hard to understand, but it is actually a right to future cash flow of a given country. It is a sort of perpetual debt with zero coupon issued by a given country. So, if the country issues more money, it means that it issues more debt, so as a dilution mechanism it yields less cash flow to each unit of money, and since the price of money (as the price of any debt) is the expectation of future cash flow, the price will decrease.
Then, this will indeed result in more inflation. I expose two ways of seeing that. First, you can think about the price of goods as the price of goods relative to the price of money. Indeed, you're going to pay $x$ for a particular good because the seller knows that it will receive $x$ and that $x$ will give him the right to a certain amount of GDP (cash flow of country). But if the amount of GDP that the money represents is lower, he will ask for a higher price. Second, traditional monetary research has derived, a long time ago, the following formula which represents what I explained in my first point, but more formally. The following is always true, it is an accounting relation :
\begin{equation}
M\cdot V = P\cdot Q
\end{equation}
$M$ is the amount of money, $V$ is the speed of money, $P$ is the price level and $Q$ is the output or quantity of goods exchanged.
Without entering into too much details on this equation (there are extended information on Internet), you can see that increasing $M$, holding $V$ and $Q$ constant, results in inflation.
To come back to your question, countries don't (only) print money to repay their debt, because they are afraid of inflation. There is a big debate on inflation (You can read it on Internet), but loosely speaking inflation seems hard to contain. So to avoid hyper-inflation situation, they try to maintain inflation (in general below 2%).
Your story does not need another company investing in X because, as you said, people will end-up with more money, but X's production will effectively increase. But it is true that companies buy currencies for investment purposes in their own country. Even local company may end-up buying their own currency, if for instance they sell product in USA (exportations), and sell the USD they receive against buying their own currency. This is why import and export (worldwide) are good indicators of exchange rate fluctuations.
Printing money to pay debt is a complicated question, and I only tried to sketch some insight here. For more information, read more on money creation and inflation (either in the academic literature or in economic textbook for instance).