Will they be allowed to even announce it?
That's an easy one: Yes, the President of the United States can absolutely announce the invention of whatever they want. Firstly, such an announcement is very likely to be protected by the First Amendment regardless of whether the announcement is made by the President or by any other person, because making an announcement is clearly a form of speech. In some cases, there might be concerns that a particular invention implicates the national security of the United States, in which case disclosure of the invention is unlawful (see 35 USC 181), but the President can unilaterally declassify anything, so under 35 USC 187, the President is very likely exempt from the entire secrecy law altogether. Obviously, that doesn't necessarily mean it's a good idea for the President to ignore the national security implications, but they have the legal power to do so if they wish.
There are also serious questions about the Constitutionality of 35 USC 181, because it constitutes a prior restraint on speech, and prior restraints are nearly always unconstitutional under well-established Supreme Court precedent. See particularly United States v. Progressive, which frustratingly never reached a firm conclusion on a closely-related issue, due to the government dropping the case. Nevertheless, there is a colorable legal argument that even national security considerations are not an adequate basis to impose a prior restraint on specific people in this fashion. If this argument is correct, then anyone can announce the invention of anything they like, President or not.
As to whether the President can patent it, it depends on whether they received federal funding to conduct the research, or did it on their own time and with their own money. If they did it on their own time, then the answer appears to be "yes, they can patent it," as far as I can tell. If they did it with federal assistance, then complicated rules apply to protect the national interests of the United States.
As far as conflicts of interest are concerned, the normal way to deal with this problem is to put all of the President's assets (held before they were elected) into a blind trust, which might or might not then proceed to liquidate and/or diversify the President's portfolio in order to further distance it from any specific company or industry's interests. By design, the President should neither know nor control how, when, and whether that diversification happens.
It's not common for the President to invent something world-changing while in office, because the presidential office is already more than a full-time job. As a result, any specific discussion of how this problem would be solved will necessarily be somewhat speculative. I imagine that the President would proceed to create a corporation or other legal entity, give the patent to that entity, and then hand its ownership over to the President's pre-existing blind trust. But this is very much uncharted territory, and it's possible that the White House might come up with an alternative means of insulating the President from the conflict of interest. For example, they might form some sort of committee to formally advise the President and provide a paper trail of justifications for the President's actions with respect to their invention.