The One Direction member wrote the song with the 'All of Me' hitmaker as part of his work unrelated to the boy band and it has been pitched to US 'X Factor' duo Alex and Sierra for their debut album.
According to the Daily Mirror newspaper, Sierra said: "Our favourite [song] is one that Harry Styles wrote with John Legend, it's beautiful and lovely.
"[Harry] is actually an amazing writer, he's pitched us a few other good ones and they're really good."
The 20-year-old singer is said to have worked on nearly 20 tracks and has been described as an "amazing writer" by music mogul Simon Cowell.
The 'X Factor' boss recently took to Twitter to reveal he had been listening to the "fantastic" demos for Alex and Sierra.
He posted: "Am listening to the Alex and Sierra demos for their upcoming album. Fantastic. It's seriously good. I can't wait for everyone to hear it."
Lyrics for the romantic ballad include: "I saw your face, I heard your name / Felt the blood rushing through my veins / I still remember / How could I forget?"
A source added: "It's a testament to Harry's talents that he can work alongside John - who is, without doubt, one of the most gifted songwriters of a generation."
American indie pop duo Alex Kinsey and Sierra Deaton won the third and final season of the US version of 'The X Factor' and were mentored by Simon Cowell.
They were the only group ever to win the American show.
Harry, who is still focused on work with his band mates Zayn Malik, Louis Tomlinson, Liam Payne and Niall Horan, is credited to 26 songs on the American Society of Composers, Authors and Publishers database - 18 of which have never been heard before.