Historically, stocks have averaged an annualized return of 10%. That's better than the average annualized inflation rate. It does mean you must have a longer time horizon. That way, you can buy and hold even if the value temporarily drops.
Historically Stocks give you 10% yearly but then have a huge drop once a decade which ruins everything all together, that is the problem. Whereas crypto has been going up super fast and it has made people more money than anything else in history ever did, more than any stock, more than the stock that went up the most in the past 10 years, it has made super a lot of money.
The question here is not "why people invest into stocks", that alone is not enough because it is left with question of "what should they do?" but when you ask "if we have CRYPTO, why people still buy stocks" which answers that one and asks why not go with crypto which has historically gained people more money than stocks ever did and instead go with something that gives 10% which is just a daily change in the crypto world nobody even cares. That is a valid question to ask.