What makes it legal? If you find code on GitHub without a license, then this does not mean "public domain". It means "the author has given permission for you to view this, but nothing more". Arguably using it for training counts as "more".
So my question would be "what license entitles OpenAi to use my content"? It could be that as part of the user agreement of the website you gave some rights to the website and they sold it on to OpenAi, could be fair use, could be "does not count as 'more'",... .
Bad analogy: For money laundering we have similar rules. If you suddenly appear with a large amount of money/data, then the obligation is on you to show that it is clean, not on others to show that it is dirty. You can disagree with that (innocent until proven guilty etc.), but it is not clear cut which way around things should be.