In the mid-1980s a teenage musician named Eric Bishop went to play piano for the rich white folk outside his hometown of Terrell, Texas. Bishop was driven to the house by a schoolfriend, who was then ordered to wait outside in the car until the recital was over. "I can't have two niggers in my house at the same time," the owner explained.

If living well is the best revenge, then Eric Bishop provides a study in payback. Recast in the role of Hollywood star Jamie Foxx, he has a Grammy for his music and an Oscar for his acting. By rights his latest movie should count as the icing on the cake, in that it's about a freed slave on a mission of reprisal. Except that the film's critics see things differently. Believe the nay-sayers, in fact, and you may conclude that Django Unchained is nothing more than another dubious commission, a fresh line in exploitation. Another performance for the benefit of wealthy white employers.

Directed with gusto by Quentin Tarantino, Django Unchained casts the actor as a black bounty hunter who kills white outlaws and gets paid for his trouble. The drama bounces from Texas to Mississippi on the cusp of the civil war, effects a shotgun wedding of 60s spaghetti western with 70s "slavesploitation" and douses the magnolia in arterial blood. It also kicks some hornets' nests along the way. In recent weeks Django has faced criticism for its use of racist language and its cavalier treatment of explosive material. Director Spike Lee claims the film is "disrespectful to my ancestors" and has refused to see the thing on principle. "American slavery," he later tweeted, "was not a Sergio Leone spaghetti western." Implicit in his comments is the sense that this is somehow not Tarantino's tale to tell.

Foxx has his phone in his hand and his cap on his head, the peak twisted off-centre so that it points to two-o'clock. I'm barely through the door when he's returning fire, defending the film for all that he's worth. "The question for me is: where's Spike Lee coming from?" he says. "He didn't like Whoopi Goldberg, he doesn't like Tyler Perry, he doesn't like anybody, I think he's sort of run his course. I mean, I respect Spike, he's a fantastic director. But he gets a little shady when he's taking shots at his colleagues without looking at the work. To me, that's irresponsible."

Samuel L Jackson on Django Unchained: 'Slavery was perpetuated through fear and intimidation' - video guardian.co.uk

Besides, he adds, the history of entertainment is littered with white guys who told black stories, and white singers who sang black songs. Sometimes that's good and sometimes it's bad. "But you got to look at the individual cases. When Pat Boone covered Little Richard, you think, 'Huh?', he's got no affinity for it. Good Golly Miss Molly? I don't think so. But you can't tell me that Eminem ain't hot 'cos he's white or that Elvis Presley isn't a bad motherfucker, or that Quentin Tarantino can't do whatever he likes, 'cos damn straight he can."

The actor admits that OK, yes, he had to overcome some qualms of his own. But he was reassured by the director's reputation and by the presence of a peerless supporting cast. Leonardo DiCaprio plays Calvin Candie, the sadistic plantation owner, smirking into the zoom lens. Samuel L Jackson is Stephen, the malevolent, all-seeing "house slave": the Uncle Tom to end them all. Both men can be viewed as nightmarish southern archetypes; unruly ghosts in the wings of American history. And yet Foxx has now made his peace with the basic thrust of Tarantino's assault. If there are elements to Django that make you angry, then so be it. "They're supposed to."

Foxx was born in Texas in 1967 and was largely raised by his maternal grandmother, whom he credits as an inspiration. In his teens he was a choirboy, a classical pianist and a football quarterback on the high-school team. In his 20s he worked as both a musician (he has since released four albums) and a standup comedian on the Los Angeles club scene. At the open-mic sessions he would mimic Ronald Reagan and Sammy Davis Jr. He told jokes about how Bill Clinton was really America's first black president and about how Mike Tyson was a little like an untrained pit-bull let loose in the sitting room. His big break came when he joined the cast of the TV sketch show In Living Color.

Foxx explains that he changed his name to ensure better slots on the open-mic circuit, reasoning that female performers were usually called up first and that an androgynous tag might prove an advantage. The trick paid off and helped make him a star. In Living Color paved the way for film roles opposite Robin Williams, Will Smith and Al Pacino. He bagged an Oscar nomination for his turn as an imperilled cabbie in the Tom Cruise thriller Collateral and went on to win the best actor prize for his full-throttle impersonation of Ray Charles in the 2004 biopic by director Taylor Hackford. Acting has been good to him, given that he appears to have fallen into it backwards.

"Yeah well," he concedes, "it wasn't part of the plan. I was just doing my music and my standup and then In Living Color came about and all these other interesting acting jobs followed off the back of that. And I had to learn to respect it. At first I thought: 'OK, this is cool.' But then with Ray I had to take it seriously, I had to realise its significance. And I'm thankful that I did. Because if I had got on doing music back in 1990 or whenever, I'd probably be singing on a cruise ship now. 'Hey everybody! Remember this from 1989?'"

Jamie Foxx as Ray Charles in Ray. Photograph: Nicola Goode/AP

In the meantime, I'm tempted to view Foxx's life as a grand act of reinvention; a flight from his past, playing piano for racists in the state of his birth. But the actor is having none of it. Despite everything, he still cares for Texas. "I mean, yeah, there are certain things people are gonna say about Texas, or say about the south, but it is what it is. I had a great upbringing and you learn how to get along, to do what you need to do as a young black man growing up in the south. You know, I performed at the new [Dallas] Cowboys Stadium a while back. There was T Boone Pickens, George W Bush, Jerry Jones. And meeting those guys as just regular people outside of politics, you realise they're great people. They're just like me and you."

Can he be serious? I confess that I had Bush cast more in the role of the Calvin Candie-ish plantation owner, smirking from his veranda while the field hands do the work

"Yeah," says Foxx. "But you don't know, because you don't know the man. There's a difference between the man and his politics. I'm not excusing anything George Bush did in his politics, but I rate people on how I meet them. That's not going to change me from being a Democrat to a Republican, but that's just the team they play for. Different values, different ways of doing things. But that Texas camaraderie: there's nothing like it."

Jamie Foxx and Leonardo DiCaprio in Django Unchained. Photograph: The Weinstein Company/Sportsphoto Ltd/Allstar

Foxx checks his phone and then shoots me a look. "You're knee-jerking," he says. "Same way people did with Django. They knee-jerked to slavery, they knee-jerked towards the n-word. But I come from the south and that's where the word grew. And I think that gave me an upper hand on the material. I know people like Stephen. I know people like Calvin Candie. I played cheese-and-wine parties for men who called us niggers. But my grandmother worked as a housemaid all her life and she taught me some truths. I learned those lessons and I learned them in the south, and I did a pretty good job of it too. So now, when I go back to Terrell, all the people come out. Smalltown boy done good."

I wonder what his grandmother would have made of Django Unchained. No doubt the language alone would give her conniptions? "No, no, my grandmother used to cuss like a sailor. 'Nigger, you don't bring your little ass in here, I'm gonna whup it real good.' Django wouldn't bother her at all."

On adopting his stage name, Foxx admits that it didn't feel real. It was a costume, a pose, a magic ticket to get him through the door. These days it feels like a much snugger fit. He was Eric Bishop in Texas and now he's Jamie Foxx in Hollywood and there are only a few people left who remember how it used to be.

He thinks it over. "My sister never calls me Jamie Foxx," he says finally. "My sister detests Jamie Foxx. She says to me: 'You are Eric Bishop. Don't you come here with your Jamie Foxx shit.' And even with Django, she'll be happy when it all calms down, 'then you can go back to being just you'. That's refreshing, you know. She's never been swayed by the success or the lack of success."

Back in the early days, half a lifetime ago, Foxx had a standup routine about the roles that we play. Everybody has to put on a show, he said. But for African Americans the bar is set still higher. They have to perform like Oscar-winners, passing themselves as white to survive the working day.

"Well yeah, that's right," he says. "As a black American, when you leave the house, you take on a role. At my house I'm extra black. Now that's too black for the office, so you got to tone it down. You get home and you're tired: 'Whoo, I had to be white for eight hours today.' Other guy says: 'That's nothing. I had to be white for 12 hours 'cos I had a dinner meeting.' So it's sort of a joke but there's truth to it too. In order to navigate, you have to pull it back a little. That's the lesson we learn."

Maybe less so these days, though? The former Eric Bishop shrugs and smiles. "Not so much, maybe not so much. We're getting there," he says. "The world is evolving."

Foxx on film

Collateral (2004)

After more than a decade in movies, Foxx surged to the front of the rank courtesy of his Oscar-nominated turn as a taxi driver held hostage by Tom Cruise's contract killer. Michael Mann's direction makes the most of LA's empty urban spaces.

Ray (2004)

The late Ray Charles is conjured up in all his playful, lustful, anguished glory in this otherwise stolid, respectful biopic of the legendary musician. In his Oscar acceptance speech, Foxx paid tribute to his grandmother, who taught him how to be "a good southern gentleman".

Miami Vice (2006)

Foxx reunited with Mann for a lush big-screen treatment of the 80s TV show about two roguish cops patrolling the art-deco seafront. Quentin Tarantino would go on to cast Foxx alongside Don Johnson, best known as Crockett on the original TV series, in Django Unchained.

Dreamgirls (2006)

Foxx stars as sweet-talking Curtis Taylor, a thinly veiled Berry Gordy, who founds a record label and helps usher black soul singers before a mainstream white audience. Jennifer Hudson won an Oscar for her support slot as his tempestuous star turn.

The Soloist (2009)

Foxx brought his classical training to bear on his role as Nathaniel Ayers, a real-life musical prodigy whose career is derailed by schizophrenia. The film flopped and the critics were unimpressed – although both Foxx and co-star Robert Downey Jr emerged with their dignity intact.

The Amazing Spider-Man 2 (2014)

For his next trick, Foxx will play power-crazed Electro, enemy all of that is good, in Marc Webb's big-budget comic-book sequel. The actor explains that his four-year-old daughter was alarmed on learning that Electro is the villain. "Damn," she said. "That means Spider-Man gonna beat you up."

Django Unchained is released on 18 January