Danny Trejo is firmly established in his second life as a movie actor, and is currently digging into "the best eggs Benedict in town" in a booth at Musso & Frank on Hollywood Boulevard. Meanwhile, he is regaling me with tales from his first life, as a junkie, professional thief and hardcore inmate of some of the worst prisons in 1960s California. Trejo, 17 years before he had any idea about his next career, nearly blew it for good. Fate, dumb luck, and the law had other ideas, though.

"I cleaned up on Cinco de Mayo, 1968. I went to the hole after a prison riot at Soledad prison. There was a visiting baseball team in the yard that day and Ray Pacheco, one of my friends, had come down from Atascadero, the state mental hospital for the criminally insane. I guess his shock treatments were wearing off because I remember the outside team were all chewing gum, which is the one thing you could never get in prison, and Ray – who was like a little kid in some ways, but he was also a killer – wanted some gum. So Ray asked this outside guy for some, and he said: 'No, they said don't give nothing to the prisoners.' And Ray just goes off – suddenly he's pulling at this ballplayer's bottom lip like he wants to rip off his whole face. So just all hell broke loose.

"It was alleged that Ray Pacheco grabbed a free person; it was alleged that I threw a rock that hit Lieutenant Gibbons in the head – and drew blood. Those are two gas-chamber offences right there, so we went to the hole on Cinco de Mayo. We came out in August, and when we went to court, Lt Gibbons made a statement saying: 'One of them threw it, but I can't say which.' And that tossed it out of court – no case. So they put us back on the yard. I realised, shit, I may have to spend the rest of my fucking life in prison, so now some shit's gotta change. I went to the hole high, I was booked in as 'on heroin', and I just thought, there's gotta be something better in life than this shit. Because the way this thing happened, with all these months in the hole, I'm clean now, sober, so everything else is on me."

Danny Trejo in Machete.

Trejo was paroled in August 1969 and – forever grateful to AA and Narcotics Anonymous – worked quietly as a drug counsellor for 15 years before bumping into novelist, screenwriter and ex-con Edward Bunker on the set of Andrei Konchalovsky's Runaway Train in 1985. (Bunker appeared in Reservoir Dogs as one of the early casualties, and the Tom Noonan character in Heat was based on him.) They'd met before, in their other, renegade lives.

"Ed Bunker was actually my mentor. The first time I met him, my uncle Gilbert bought a robbery from him, in 1962. In the movie they made from one of Ed's books, Straight Time, Dustin Hoffman goes to a bar and he buys a robbery from Edward Bunker himself, and that was a real robbery he planned years before, where I ended up as the wheelman." This time he ended up as fight trainer to Runaway Train's star Eric Roberts, at $350 a day – unimaginable money for Trejo. One step into another world entirely.

But it is Trejo's first life, truly una vida loca, that demonstrates why his first 20 bit parts on the big screen were all no-name "thug", "boxer", "gangbanger", and "hoodlum" roles – and why he brings such authenticity when he arrives on set. Now, after 25 years of cameos and small roles, the director Robert Rodriguez has cast Trejo in a part they've both been talking about since they first met on the set of Desperado nearly 16 years ago.

Rodriguez has recalled elsewhere that, when the pair first met, "I thought this guy should be like the Mexican Jean-Claude Van Damme or Charles Bronson." Trejo remembers, too. "We were in Acuña, in Mexico, filming Desperado, and nobody knew who Antonio Banderas was – back then he was still a Spaniard. I'm standing there without a shirt on, and all of these people are crowding round me for autographs, all Mexican people. Robert comes up and says, 'Maybe they think you're the star of the movie.' I said, 'I am! I'm the star of every movie I'm in!'"

Danny Trejo in Machete. Photograph: 20th Century Fox/Everett/Rex

Certainly he's the most striking face in every movie he's in, even if Machete is the only one in which he's officially had a starring role. His list of credits on the Internet Movie Database is up to 204. So many credits, in fact, that Trejo often turns on the TV late at night, and watches half an hour of something before realising he's in it.

Machete gives us Trejo as a former Federale whose wife and daughter are murdered by cartel kingpin Steven Seagal. A year later in Texas, Machete is reduced to illegal day-labour until he's hired by a shady businessman to assassinate a senator. Turns out it's a set-up, a deliberately botched attempt designed to foment an anti-immigrant backlash. Machete, suddenly topping the FBI's 10 Most Wanted list, must flee for his life from law and drug lords alike, but find aid and comfort in the immigrant community before enacting his spectacular vengeance.

Rodriguez's most daring conceit, given the furore over Arizona's toxic law against illegals, is to give raw and vivid life in his movie to every last paranoid, gringo-racist Minutemen militia nightmare about illegal immigration. He invents an entirely imaginary "Mexican network" that coalesces whenever a Mexican is in danger. At a given signal, yard men drop their weed-whackers and leaf-blowers, short-order chefs and busboys throw down their spatulas and hairnets, and all rush to their compatriot's rescue. Although the script was completed a decade and a half ago, Machete arrived in the midst of a racially charged immigration debate feeling newly wrought.

"I know it's been controversial," says Trejo, "but come on, it's an action movie and a comedy. The political undertones in the movie are very, very strong, because you should say whatever you want with a movie. But this guy over here, he sees it one way; me, I see it another. I mean, ask yourself, what was Snow White doing behind closed doors with those seven dwarves, man? You see what I'm saying? You can find whatever you want if you look at things the wrong way. The reality is we completed the movie a year before this crisis in Arizona."

Trejo has a million good stories about movie sets and prison, but he doesn't have a bad word for anyone in either community (though at one point he does murmur: "Sizemore – what a fuckin' train wreck"). "With actors," he says, "the best advice you can give is: the whole world might think you're a movie star, but you can't. Nobody listens, but every hand you shake on the way up is connected to every ass you gotta kiss on the way down."

Politeness was hard-learned knowledge for a street-reared tearaway kid. He first smoked pot at the age of eight, mainlined heroin at 12, and graduated to robbing pharmacies with his uncle Gilbert (just six years older) because "we were junkies, man, and drugstores got a lot of drugs you can't get nowhere else. No one was as crazy as we were, man. We had .357 Magnums at a time when even most criminals didn't carry guns at all."

Useful hinterland, it seems, when it comes to facing down Method hotheads who believe that merely thinking they're badasses automatically makes it so. He tells me of working on Death Wish 4, and taking issue with a young actor berating the late Perry Lopez, then quite old and weighed down with emphysema. Trejo, fed up, took the kid aside. The young man said he was just getting into character, Trejo recalls. "I said: 'Well, you better back the fuck outta there cos your character's about to get his ass beat.' Suddenly, standing right behind me was Charles Bronson, and I'm all worried because, well, y'know, death threats on a movie set 'n all, but he just said quietly: 'I like your way of dealing with people.' Never saw that actor again, either."

The path from the hard-as-nails penitentiary to the Hollywood premiere runs long and tough, and not many make it. Trejo's never looked back since, though he says his mother was always sceptical. "I'd visit her and say, 'I just made a movie with Robert De Niro.' She'd say, 'Oh, it's just play-acting, get a real job.' And then I had four days on The Young and the Restless [an afternoon TV soap] and sure enough my mom screamed: 'Ah, mijo, you finally made it!'"

Machete is released next Friday.