Why does my money disappear in the GTA V stock exchange?

Exploiting the stock market is Rockstar's intended design choice when Lester's assassination missions, and is also why Lester tells you what companies are going to be affected by the assassinations.

Stock market portfolios are not shared between characters. It is possible you swapped characters between making the investments and reviewing the profits. While character Franklin has $500,000 invested in Debonaire, Trevor does not. It is also possible you are looking at the wrong investment portfolio as there are two portfolios: LCN and BAWSAQ. Looking at the LCN portfolio will not show you investments made in the BAWSAQ portfolio.

Another potential reason is that you invested in the wrong company. You might have unwittingly put your stock into Redwood while thinking it was Debonaire Cigarettes. Unlikely, but not impossible; you could have tanked your own shares and now can only be recovered for a fraction of it's original value.

Lastly, you may have encountered a glitch. Rockstar games have a solid reputation for producing glitch-free in comparison to, say, Bethesda Softworks but that does not mean it can't happen. Other players have reported losing their investment money while playing Lester's assination missions. It could be possible it happened to you too. In this case, your only options are to load from saved game, check for any available updates, restart your console and hope for the best. Sorry about that...