The prophecy was spoken by Professor Sybill Trelawney during a job interview at the Hog's Head Inn (1980). Severus Snape overheard the first half and reported it to Voldemort.
"The one with the power to vanquish the Dark Lord approaches… born to those who have thrice defied him, born as the seventh month dies… and the Dark Lord will mark him as his equal, but he will have power the Dark Lord knows not… and either must die at the hand of the other for neither can live while the other survives…"
The prophecy could have applied to Neville Longbottom as well, but Voldemort chose Harry, making it self‑fulfilling.