They Didn't, At Least Not For Sure
Enough leaks sprung from the Ministry that the fight between the DA and Death Eaters centered on the Hall of Prophecy, and it was well known that both Harry and Voldemort were there that day.
Therefore, the (correct) rumormill began to swirl that they were obviously there for a prophecy, and that said prophecy dealt with Harry and Voldemort.
Naturally, in a really, really bad time people will cling to whatever hope there is, and in this case it was the hope that the prophecy was that Harry was 'The Chosen One' to kill Voldemort. They already knew that something was up because Voldemort had, famously, failed to kill Harry. It wasn't a large step from there to assume that maybe Harry's protected by something more than luck.
The REAL details of the prophecy never got out to the public, at least not before Voldemort and Harry had their final standoff at the Battle of Hogwarts.