The Little Britain star began working with Cowell when they both appeared on the judging panel of U.K. TV show Britain's Got Talent, which wrapped up last month (May12).
Walliams has now begun writing his fifth children's book and reveals his most devious character was inspired by Cowell.
He says, "It's about a little girl who befriends a rat and this one has a really evil villain in it, so he's the one who wants to turn that rat into a burger.
"It's based on someone who was on Britain's Got Talent... and it's not (fellow judges) Amanda Holden or Alesha Dixon."
When asked whether his fictional bad guy could ever be as evil as Cowell, Walliams quipped, "I'd like to but it's hard to outstrip reality."
The stars were on a break from filming upcoming BBC TV comedy Blandings in Northern Ireland last week (ends06May12) and they happened to be present for Alan and Nicola Forbes' celebrations following a ceremony at Crom Castle.
Nicola tells Britain's The Sun, "It made our day, we're so lucky. The wedding was already unbelievable and everything was outstanding, but what really made it was David turning up. We'll never forget it.
"No one could believe it. Then he had everyone in stitches when he jumped for my bouquet."
"I'm writing a sitcom and getting together a comedy drama. The sitcom is for BBC1 and set in a school but it is very early days. It is a hard thing writing a sitcom, much harder than doing a sketch show. I hope it will be out next year." Little Britain star David Walliams on his latest project.
The Little Britain star was heartbroken after visiting Kisumu, Kenya last year (11) and meeting 12-year-old Philip Onyango, who had been living on the streets after his parents died four years ago.
Walliams dedicated his efforts for Britain's Sport Relief drive to Onyango this year (12), and took to his Twitter.com page on Wednesday (11Apr12) to report the youngster now has a roof over his head.
The comedian posted a photo of the place where Onyango used to sleep, and tweeted, "The boy I met on my Sport Relief trip to Kenya Philip Onyango doesn't sleep here anymore, thanks to all your generosity."
Walliams swam along the length of England's River Thames to raise money for Sport Relief, which provides food, education and clothing to disadvantaged people around the world.
"I have been given the honour of running with the Olympic torch the day before the opening ceremony. Just one problem, I can't run!" British funnyman David Walliams is concerned about his 2012 London Olympics honour.
The Little Britain star was invited to meet Cameron at his home in London's Downing Street to discuss his 140-mile (225-kilometre) marathon swim in the Thames to raise money for Britain's Sport Relief charity.
But Walliams didn't sugar coat his experience when questioned by the U.K. leader, who told him, "You swam through my constituency at Letchlade... I thought when you were doing that bit, I thought that looked all right. Then when you started getting closer to London..."
Walliams replied, "Once you get to the Thames in London, it's disgusting. The water stinks, and it's brown. No one on a bridge in London has looked at the water and thought about going in."
Comedian John Bishop, retired rugby star Josh Lewsey and TV presenter Helen Skelton also joined Walliams at the meeting with Cameron after raising millions for the biennial charity event.
Walliams and fellow funnyman John Bishop will join U.K. TV presenter Helen Skelton as guests of honour at David Cameron's London residence to chat about their efforts to raise money for the Sport Relief fundraiser.
Each star has taken on gruelling athletic challenges for the cause - Walliams swam the River Thames, Bishop tackled a triathlon, and Skelton trekked to the South Pole.
Taking to his Twitter.com page to share news of his invitation, Walliams couldn't resist joking about reprising his Little Britain character Sebastian, who plays an official aide besotted with the Prime Minister.
He tweeted, "Me, John Bishop and Helen Skelton have been invited to 10 Downing Street later this week... to meet the Prime Minister to talk about Sport Relief. Should I go as Sebastian from Little Britain?!"
The Little Britain star, accompanied by his mum and model wife Lara Stone, headed to Reigate Grammar School in Surrey, south east England on Wednesday evening (21Mar12) for the fundraising bash in aid of the U.K.'s Sport Relief organisation.
In a series of posts on his Twitter.com page, he writes, "A great night at my old school Reigate Grammar School raising money for Sport Relief with my two favourite ladies.
"Thankyou (sic) to everyone for being so generous. £25,000 was raised! My old teacher Jim Grant interviewed me on stage. I was very lucky to have a few inspirational teachers."