It's not impossible for a developing country to achieve economic growth without foreign investment, although in some circumstances it could be extremely difficult.
Suppose a country's gross output in year 0 is $Y_0$. Assuming autarchy, we can write:
$$Y_0 = C_0 + I_0$$
where $C$ is consumption and $I$ is gross investment (government expenditure is assumed included within either $C$ or $I$, depending upon its nature). Investment here includes not only investment in factories, equipment and infrastructure but also investment in human capital via education and training.
In order for the economy to grow by increasing its stock of capital, $I_0$ must as a minimum be larger than the year's depreciation of capital (and for a worthwhile rate of growth it must be significantly larger). While technological progress is sometimes described as a separate source of growth, the practicality often is that new techniques have to be embodied in physical equipment and require training of the workers who will apply them. Most economic growth therefore requires additional capital.
In assessing whether such investment is possible, the implications of the implied level of consumption ($C_0 = Y_0 - I_0$) have to be considered, and here both economic and political considerations arise. A minimum economic criterion is whether consumption is sufficient to support the population at subsistence level. A stronger criterion is whether it is sufficient to support the population at the level to which it has recently been accustomed. The government, however, may well view the situation in terms of political feasibility, and focus especially on whether it can meet the expected living standards of those groups on which it mainly relies for support.
In practice, therefore the distinction between possible and impossible is imprecise. There is a trade-off between having sufficient investment for the economy to grow and maintaining a satisfactory level of consumption. How that trade-off is addressed will depend upon the particular economic system and degree of state control. In a highly centralized economy, the balance between $C_0$ and $I_0$ will be largely a government decision. In a more market-oriented economy, it will result from many separate decisions by firms and individuals. But in either case, if a country is only just above subsistence level, or if output is below trend (perhaps due to a poor harvest or natural disaster), then it is likely to be very difficult to achieve sufficient investment for growth.
In some circumstances, therefore, foreign investment may be virtually essential for growth. In others, although not essential, it may help to mitigate the problem of achieving growth while maintaining a satisfactory level of consumption.