A undated, black-and-white photograph does show a young Nancy Pelosi with President John F. Kennedy.
No evidence suggests that Pelosi ever had an affair with JFK.
In May 2020, social media users circulated an old black-and-white photograph picturing U.S. President John F. Kennedy standing with a young woman, with a caption that reads, "Nancy Pelosi and JFK, whom she had an affair with for 7 long years. He was 43 years old in 1960, she was 20":
The undated photograph does show a young Nancy Pelosi, who would go on to become a U.S. representative the speaker of the House, standing next to JFK. Pelosi posted the picture, which The Washington Post credits to photographer Lois Raimondo, to her Facebook account on January 20, 2011, along with a caption reading:
50 years ago today, I was a young Trinity College student standing outside in the sunlit cold, listening to a young President's inaugural call to 'the energy, the faith, the devotion ... that will light our country and all who serve it -- and the glow from that fire can truly light the world.' The leadership of President John F. Kennedy is not just a memory, but a living force that still asks every citizen to lead -- and perhaps that is the most precious gift of all.
The 35th President of the United States reportedly had numerous extra-marital affairs with women (allegedly including actress Marilyn Monroe) but nothing suggests that Pelosi was among them.