Also Andrew Wiles working in secret for 7 years out of fear of someone scooping him.
I've always found the story of A. Wiles sad and frustrating. He worked in secret for 7 years. He submitted a (incorrect) proof at year 4 or so. Reviewers found a problem, but he decided kept all secret for many years after. He didn't even proof the last theorem of Fermat directly, he proved some conjeture that someone else before him, proved that it implied Fermat last theorem...
I found this behavior against healthy science practices and only driven by ego. Unfortunately, I find this too often at work (working in academia). Most probably I'm too naive...
Partially; but also in order to be able to focus, as stated by himself in https://www.pbs.org/wgbh/nova/transcripts/2414proof.html:
"But I realized after a while that talking to people casually about Fermat was impossible, because it just generates too much interest, and you can't really focus yourself for years unless you have this kind of undivided concentration, which too many spectators would have destroyed."
But yes; him reaping the benefits of himself having the idea first was part of it too; as far as I am aware.
-----
Which is still something completely different than some anonymous organisation keeping mathematical research secret because it is better for hype reasons. One is competition between individuals or groups within a field; the other is boring and sometimes borderline nihilistic generating of mathematical knowledge as an marketing asset.