I just started playing it and this tune came, ‘cuz that’s what happens. They just, sort of– they COME, you know. It just came and I couldn’t think of any words to it, so originally it was just, ‘Scrambled Egg.’ It was called ‘Scrambled Egg’ for a couple of months, until I thought of ‘Yesterday.’ And that’s it. True story.
—Paul McCartney, 1968

‘Yesterday’ is Paul completely on his own, really. We just helped finishing off the ribbons ’round it, you know — tying it up.
—John Lennon, 1966

Wikipedia:

“Yesterday“was originally recorded by the Beatles for their 1965 album Help!. Although credited to “Lennon–McCartney”, the song was written solely by Paul McCartney. At the time of its first appearance, the song was released by the Beatles’ record company as a single in the United States but not in the United Kingdom (for further details see below). Consequently, whilst it topped the American chart in 1965 the song first hit the British top 10 three months after the release of Help! in a cover version by Matt Monro. “Yesterday” was voted the best song of the 20th century in a 1999 BBC Radio 2 poll of music experts and listeners and was also voted the No. 1 Pop song of all time by MTV and Rolling Stone magazine the following year. In 1997, the song was inducted into the Grammy Hall of Fame. Broadcast Music Incorporated (BMI) asserts that it was performed over seven million times in the 20th century alone.