"I pulled that off the top of my head," he says. "And six months later, I was like, 'Hi Tom'. What a hypocrite! It was fantastic, though." Lake Bell and Simon Pegg play singles looking for love in Man Up. This month, Pegg appears in Mission: Impossible – Rogue Nation, the fifth in the franchise; his character has morphed from a pudgy computer hacker to a fully trained agent in the field. He even wins a physical fight. "I am excited for people to see that," he says, "because it was kind of bad-ass." Pegg – at 45, still giving every impression of being a wide-eyed fanboy – first came to notice in Spaced, the sitcom he wrote with co-star Jessica Stevenson. It was as Tim in Spaced – broadcast in 1999 – that he established the geeky, cheeky persona that is still working for him. Tim, recovering from being dumped by his girlfriend, spent most of his spare time on Playstation with his best mate (played by Nick Frost, Pegg's best mate in real life). At one point, he was sacked from the comic shop because he spent five minutes berating a small child for liking the Star Wars prequels – clearly a betrayal of holy writ. As it happens, Pegg was able to hang out last summer on the set of the next Star Wars film, which is being directed by his friend J. J. Abrams; it was Abrams who cast him in Mission: Impossible III and then as Scotty in the next-generation Star Trek franchise.

Abrams also persuaded Pegg to take on his latest venture into the stratosphere: writing the script for the next Star Trek film with US television writer Doug Jung. Scary, he agrees. A very, very big deal. "I quit like three times, I think. Every time, J. J. Abrams said, 'Oh come on, Simon ...'" British actor, writer and comedian Simon Pegg aims to wake every day with a smile on his face. Credit:Tracey Nearmy What would the Simon Pegg of Spaced – who came to that series as a jobbing stand-up, so hard-up that he and Frost shared a single bed in a shared flat – make of all this? "Funny, I remember there was a line in Spaced about certainty," he says. "I said, 'As sure as eggs is eggs, as sure as day follows night, as sure as every odd-numbered Star Trek movie is shit ...' – and I am now writing Star Trek 13. I think I would have been apoplectic with the irony of it all, you know. And I love thinking about that, the circularity of having been a fan of these things as a kid and now being part of them. And I feel very lucky and I feel – in my quietest, most private moments – proud of myself." Pegg's latest venture, Man Up, seems a long way from fanboy territory. The film is a romantic comedy in the Four Weddings mould, written by first-time feature writer Tess Morris and directed by Ben Palmer, who did The Inbetweeners Movie. Pegg plays Jack, a recently divorced 40-year-old Londoner, who is hyped up for a blind date with a high-achieving young woman of 24. Instead, in a classic rom-com trope of mistaken identity, he meets Nancy (Lake Bell), who is 34, messy and a bit frumpy, but likes the same films as he does and is a whiz at tenpin bowling. You can see where that's going.

Man Up is hardly Pegg's first foray into Hugh Grant territory; besides the sci-fi comedies he has co-written with Wright and Frost, he has been the hesitant suitor or rejected boyfriend in How to Lose Friends and Alienate People, in 2014's Hector and the Search for Happiness and in Run Fatboy Run. Women like him and he makes an appealing swain. Mostly, he seems to be playing someone much like himself, although he says he doesn't identify at all with the covertly desperate Jack. "I've been married for 10 years [to music industry PR Maureen McCann; they have a daughter and two dogs]; I can hardly imagine what it would be like to be out in the world again." It turns out Pegg is a long-standing fan of the rom-com genre. "That geek thing of mine is something I've fostered, you know," he says a bit sheepishly. "It is part of me – very much so – but I wrote an essay at university comparing Woody Allen's Annie Hall with When Harry Met Sally. I was very much a fan of that romantic dynamic: the unrequited love, the challenged love." In another university dissertation, Pegg wrote a Marxist analysis of the way we watch popular films. His thesis, drawn from thinkers such as Raymond Williams and Antonio Gramsci, was that we collude in a film's world view – whether we agree with it or not – by watching it without criticism. In other words, no film is just a bit of fun. He is famous for this, because he is asked about it all the time; giving instant structuralist readings of any film a journalist cares to name has become his interviewing equivalent of a party piece. So how would he deconstruct Man Up? He's into it quickly. "I'd see it as a feminist subversion of a call to patriarchal dominance, because it's written by a female, which is great," he begins. "I'd say it had a contiguous narrative that probably reinforced various stereotypes – but in a way that was acceptable because, um, it was enjoyable." He starts to laugh. "Ultimately, those films are reinforcing the heterosexual couple at the heart of late capitalism, perpetuating the myth that this is the way things have to be. To undermine that, you can't really have a happy ending." But he loves a happy ending, in films and in life. "The most important thing – for me, the true measure of success – is whether you're happy or not," he says. "You can have everything you're supposed to have to be successful and be suicidally miserable. Do you know what I mean? I really love my job and that makes me feel like I've been successful, because I'm smiling when I'm waking up in the morning."

He would like to direct and he would like to do some serious stage acting, so if the bottom falls out of his Hollywood genre career tomorrow, "there we go, I had a good time". Because he will always have Wright and Frost and their producer, Nira Park, with whom he plans to keep making films. "And as long as we keep making films," he says cheerfully, "we won't starve." Man Up screens from July 23.