What would interest rates have anything to do with shares? When we say a higher interest rate attracts FII/FPI, does it not mean it is investing in shares of a company? For example, how does it help a foreign company, if it is investing in the shares of an Indian company because rates are high in India? It isn't some 'Fixed Deposit' or Mutual Fund, returns out of investment in stocks would be purely based on fluctuations of share price, nothing to do with interest rates; so how would a high interest rate deter the returns out of investment in shares?
Foreign Institutional Investors (FII) and Foreign Portfolio Investors (FPI) can and do invest in government securities as well. There may be restrictions of course leading to imperfect capital mobility. For example in India, FIIs/FPIs cannot hold more than 6% of outstanding stocks of securities.
As interest rate increases (usually because of an external shock - such as a policy shock by the Central Bank), there is (increased) room for arbitrage. This attracts investors looking to make quick money.
You are right that interests may not impact share prices, but there is some relation of course. This comes, among other things, from risk management. Portfolio managers balance risk by dividing investment in risk free government securities and equity. When return on g-secs go up, this balance goes into disequilibrium. New investors can invest more in equity as some additional risk is balanced by increased returns in g-secs (you can think of the two assets as imperfect substitutes). So this increases prospects for more investment in equity and so it makes sense to quickly invest in them as well for short term gains.
All this logic will, however, go into disarray as we bring in expectations of future interest rates. This is why FIIs/FPIs are also referred to as hot capital flows. These investments are short term and the flow can quickly reverse with slight changes in market sentiments and expectations.