That's called insider trading and those who do that ends up in jail or at best have to hide in the sun for the rest of their life.
https://arstechnica.com/information-technology/2018/01/intel...
The article also cites Equifax's CEO selling before the news of their data breach went public.
And that's just the ones that are prominent enough that everybody knows about it.
Official resignation letter:
https://blog.waymo.com/2021/04/capstone-of-my-career-email-f...
"Interpreted" letter:
https://gist.github.com/ChuckM/ff5fc8c800c7fe9160483b68ec45a...