Foreign funds come into a country when investors outside the country can make larger gains by investing in various assets in the country compared to the gains they can make by investing in assets in their own country.
For example, investors outside a country A would buy stock in A rather than in their own country if the industrial growth in A is expected to be very high and the price of stocks of companies located in A to rise a lot. Similarly, if banks in A give a higher rate of interest for deposits, foreign investors would prefer to invest their money in these deposits.
When inflation rises in a country, the primary financial institution in the country tries to reduce it by decreasing the money supply in the system. This is usually done by increasing interest rates; as that makes it more expensive for people to borrow money to buy products and also acts as an incentive for people to save money with their deposits yielding higher returns.
If interest rates of a country are substantially higher, foreign funds flow into debt instruments there would rise. Conversely, as economic growth is curtailed by high interest rates, there would be a decreased investment in stocks and other assets which are negatively affected by high interest rates.