Akhi, I think you are taking too much risk. It's your money, but the app will decide where to invest your money for you?
How do you even know where it will invest it?
Is there a way for you to find out, at least list of companies that it has invested your money in?
Do you have control over which companies, which product/service this app is allowed to invest your money in?
If you mean donating income from haram investment to charity, it is a part of repentance according to the link below :
https://islamqa.info/en/answers/142...-invests-it-is-the-profit-permissible-for-him
If he took it in a haraam transaction, such as selling something haraam, or as wages for haraam work, such as bearing false witness or singing.
In this case, part of his repentance is to give in charity whatever he has in his hand of this wealth.
If he is in need and he used the money to do business or to buy a car with which he can earn an income, then we hope that there is nothing wrong with that,
but if he can give in charity the same amount as the haraam wealth, that is better and makes his repentance more complete.