I've wondered about this for a while -- it seems like Churchill should have won by a landslide, having just won WWII and collected all of that prestige. I've never heard about any kind of scandal surrounding him that could have cost him the election.
I'd like to start off by saying I'm by no means an expert on this and thus my interpretation may not be the same as the general consensus
I think it all comes down to the way in which Churchill and Attlee were going to take the UK post-war. The war in Europe had ended on 8th May 1945 (Victory in Europe 'VE' Day) and the majority of the British public wanted to leave the perils and devastation of war behind.
When Churchill became PM in 1940 he formed a coalition (a thing that hadn't been seen since 1916 and wouldn't be seen again until 2010) with the Labour and Liberal parties having their fair share of say on what was to happen. By 1945, Churchill had resigned and Labour had left the coalition. George VI now had to dissolve parliament and a general election was called.
Like you said Churchill should have won by a landslide, having won the war but essentially this winning of the war made him redundant, He's won the war now what more can he offer? His greatest legacy was that war.
In 1942, William Beveridge published his seminal Beveridge Report which looked at what could be done to improve the overall welfare of society. Beveridge strongly recommended a welfare state. It became a bestseller, the conservatives were in favour of a lot of what Beveridge proposed, however Churchill (stereotypically of the conservatives) wasn't prepared to make the allowances needed to see it through, Attlee and Labour were. On this issue Churchill seemed 'out of touch' with the average electorate.
Another issue that cost him the election was the redundancy and what else he could offer that I mentioned above. The electorate saw Churchill as a great war leader but they doubted him when it came to the domestic front.
The thing that cemented this perception was Churchill & Attlee's campaign posters. Churchill's campaign poster which was his war portrait with the slogan "Help him finish the job". I don't know about you but if I read that poster back then I'd probably wonder what he was trying to say. Was the war still going on? The poster's very ambiguous and doesn't give the impression that he wanted to relax and rebuild Britain. Attlee's posters on the other hand was completely different, they had forward-facing slogans like "Let's face the Future" and "And now win the Peace" among others.
Yet another strike against Churchill was when he accused Attlee of 'behaving like a dictator' and that Labour would have to 'fall back on some sort of Gestapo if they wanted to impose socialism on Britain', the next day Atlee used those remarks to highlight the differences between Churchill the war leader and Churchill the peacetime politician.
In 1950 it was time again to call a general election, even though Labour won again they're number of seats was reduced dramatically from 393 in 1945 to just 315 this time around. Attlee was extremely disappointed. 1950 also marks the start of the Korean war and UK involvement in it. In 1951 the then chancellor Hugh Gaitskell introduced an 'austerity budget' to help raise funds for the UK's involvement in Korea, there was a dispute and Attlee began to crack under pressure. Thinking he could garner back authority and support he called another general election (which prime minsters now can't do under the Fixed-term Parliaments Act 2011), Labour lost. Churchill was back in.
Sources and further reading
The majority of the information regarding the 1945 election came from the BBC documentary Churchill: When Britain Said No (2015) and the wikipedia article on the election. There seemed to be a lot of documentaries on Churchill and the 1945 election (e.g. Churchill: The Nation's Farewell and The Churchill Obituary) that came out last year all coinciding with the 50th anniversary of his death.