Boris Johnson says he entered politics due to the “beginnings of a midlife crisis” in his mid-thirties.
The prime minister, 56, said he chose to be an MP because he wanted to “contribute more”.
Speaking to pupils at Accrington Academy in Lancashire, he said: “I used to have a wonderful job as a journalist, which I loved.
“Then, when I was about 35 years old, I had the beginnings of a midlife crisis. I knew that I had to do something.
“I felt I had to sort of start to contribute more and so I went into politics.
“It has gone on from there. There were lots of things I wanted to do.”
Mr Johnson was elected MP for Henley in 2001 while he was still editor of The Spectator, which he wrote for until 2008 – the year he became London mayor and left the House of Commons.
After two terms as mayor, he returned to parliament in 2015 as MP for Uxbridge and South Ruislip.
He was a political columnist for The Daily Telegraph and The Spectator in his mid-thirties, as well as a car reviewer for GQ magazine.
Before that he worked for The Times, and The Daily Telegraph as a reporter in Brussels.
He was sacked from The Times after he invented a quote from his godfather, the historian Colin Lucas, for a piece about the archaeological discovery of King Edward II’s palace.
As a Brussels reporter for the Telegraph, he established himself as one of the few Eurosceptic journalists.
Please use Chrome browser for a more accessible video player
Earlier this week, Mr Johnson told some other schoolchildren being a journalist was a “great job…but the trouble is, sometimes you find yourself always abusing people or attacking people”.
“Not that you want to abuse them or attack them, but you are being critical, when maybe you feel sometimes a bit guilty about that, because you haven’t put yourself in the place of the person you’re criticising,” he said.
“So I thought I’d give it a go,” he added, referring to his career change.