First, the “OpenAI" whose profits are being discussed isn't a 501(c)3 charity, but a for-profit LLC (OpenAI Global, LLC) with three other organizations between it and the charity.
Second, charities and other nonprofits can make profits (surplus revenue), they just can't return revenues (but they can have for profit subsidiaries that return profit to them and other investors in certain circumstances.)
> The whole umbrella for-profit corp they formed when they became popular should be illegal
The umbrella organization is a charity. The for profit organizations (both OpenAI Global LLC that Microsoft invests in, and its immediate holding company parent which has some other investors besides the charity) are subordinate to the charity and its goals.
> and is clearly immoral.
Not sure what moral principal and analysis you are applying to reach this conclusion.