If I invest in a popular project does that make my money safe from scams or popular projects can turn to scam as well?
If it's only driven by hype then there is a high chance for it to become a scam. You should not only base on the projects' popularity when you want to invest on it. You should also check its background like who the developers are or checking its roadmap or utility to see if it has a potential.
Just look at shitcoins now, they were very popular last year even if many of them have no real utilities. Many people bought them because it was hyped on the social media. Now their value is worthless and its developers already abandoned their project.
I agree with you that you need to carefully check who the developer of the coin is, read the roadmap and so on. But there is one good example which proves that any project can turn out to be a scam. It's a recent story with Terra Luna, when it dropped almost to zero. So if you choose altcoins, only time-tested ones. It is better not to be guided by popularity.
It is because of this many forum members do not recommend to invest long term in altcoins, even the ones which seem to be really good, as we do not know when a collapse like this can happen, and while I think there are altcoins which are worth our time at the same time I still think people should always be ready to dump their altcoins if a big enough news comes which puts their holdings at risk,m and as you mention luna is the perfect example of this scenario in action.