A genuinely global dish, chilli con carne required the culinary input of three continents. It came into being in the Tex-Mex border badlands, when men were men, with catering skills to match: a dish so simple that even a weary, halfcut cowboy could rustle one up, yet so devilishly tweakable that with no more than a heavy hand on the powder tin and a couple of pardners, he had himself the makings of a palate-flailing campfire duel. Every chilli has a tale to tell, and it usually ends with someone in a gasping mess.

Though chilli is Mex by name, it's purely Tex by nature. In fact, south of the border the dish is something of an embarrassment: a 1950s epicurean guide to Central America defined it as "a detestable food passing itself off as Mexican, sold in the US from Texas to New York". Texans, in contrast, are proud of their association with "a bowl of red" - in 1977 the dish was enshrined as their official state food.

Twice the size of Germany, the Lone Star state is vast: the quest for the ultimate chilli might as well start in its capital. In an ultra-conservative state where half the population goes to church every week and there are twice as many guns as people, Austin is an outcrop of pink hair amid the rednecks - an easy-living university town where intellectual slackers, pregnant punks and IT millionaires co-exist in harmony. There are more live-music bars on 6th Street than anywhere on earth, but if you're looking for a yeehah Texas honkytonk, look elsewhere. The semi-official civic slogan is "Keep Austin Weird".

It's a pocket of bohemia, and indeed Bohemia: many of the wheatfields that engulf the city were planted by 19thcentury Czech immigrants, part of a million-strong central European influx whose cultural legacy across southern Texas has survived. In the farmlands northeast of Austin I drive through a series of comatose old villages with names like Heidenheimer, Schwertner and Walburg, where the only place still trading is an indoor biergarten, bedecked with Bavarian flags, cuckoo clocks, beer steins and military memorabilia. The waitress apologises that her wurst-centric menu finds no place for my epicurean quarry. "But come on - you can't eat chilli without beer!" It's a point emphasised at the Texas Chili Parlor, which I gravitate to that evening. "People come asking for Perrier or Evian," says waitress Marta, '"and I tell 'em the only bottled water we serve has got malt and hops in it." When sometime Austin resident Quentin Tarantino was location-spotting for his film Death Proof, he didn't have far to look for a chilli joint with attitude.

Other than a couple of tweaks to the house rules ("NO DRAFT, NO FRIES, NO TALKING TO IMAGINARY PEOPLE"), the TCP is just as it was the day it opened in 1976. "Our chilli won't be changing any time soon," says Marta, cheerily slamming down a bowl of the house red. "Chunks of beef shoulder, chilli powder and whatever, broth and a little masa harina [tortilla corn flour] to thicken it all up." Part of that whatever is a splash of Shiner Bock, a local beer created by immigrant German brewmasters. But it still seems a strippeddown recipe. No onion? "That comes on the side." Cheese? "On the side." Tomatoes? A narrowing of the eyes. Beans?

If to bean or not to bean is the question, in Texas there is only one answer, typically delivered at length and in a tone of outraged disbelief. The essence: no beans.

With a confidence borne of years of Tabasco abuse, I've plumped for the double-X chilli, a mid-strength choice that is awarded a "beware" on the menu. I dunk in one of the crackers and take a bite. It bites back: the fulsome, salty tang of long-simmered meat sauce is soon brutally frogmarched away from my tastebuds by the capsicum heavy mob. A table of ample regulars eyes me with happy malice, but they tilt their Shiners in approval when I go for a second mouthful, then a third.

Next morning, I drive southwest to the city that counts itself the crucible of chilli. San Antonio is nearly 100 miles away - a trip to the shops by Texas standards - but culturally it feels further, with two-thirds of the citizenry of Hispanic origin. The border might be a four-hour drive south, but this is where Tex and Mex collide.

Like Austin, San Antonio has grown out, not up - the suburbs sprawl away into the hotter, dustier and slightly less arable distance, leaving the old civic core unscathed. Magnificent Aztec-themed art deco buildings line the restaurant-thronged river that winds through the downtown district. And a bleached 18th-Century mission house still stands at the city's epicentre, one of the oldest buildings in America and perhaps the closest this nation has to a site of pilgrimage.

You wouldn't want to call it a silver lining to the crowds queuing solemnly outside the Alamo, but the day Davy Crockett and his men died was the day chilli con carne was born. Defiant Americans meeting their end in a Spanish building, at the hands of the Mexicans who then ruled Texas... Throw those cultural ingredients into the pot, simmer for 40 years, and you have the first confirmed sighting of chilli con carne - cooked up on Alamo Plaza in the 1880s by street vendors who became known as the chilli queens.

At La Gloria, a bright new restaurant alongside the soon-to-open San Antonio branch of the Culinary Institute of America, I'm given a taste of chilli's genesis.

The CIA aims to survive its challenging acronym and help steer Tex-Mex street food beyond the Taco Bell strip-malls. Chef and owner Johnny Hernandez addresses me through the steam rising from arrachera en salsa de tomatillo, a central Mexican speciality cooked and served in a molcajete - a mortar hewn from volcanic basalt whose design dates back to Mesoamerican times. "You could call this the first chilli," he says, though in truth the flavour is a little too light, too couth: more of a missing link between Aztec and Texan.

There's only one place to go for the fully evolved Tex-Mex genus: across town to Mi Tierra, more of a civic institution than a restaurant, run by the same family since 1941 and currently putting sauce-rimmed smiles on over a million faces a year. Michael Cortez, grandson of the founder, leads me to the kitchens through a warren of dining rooms, each more lavishly festooned with tinsel and fairy lights than the last, all patrolled by a restless army of flamenco-dressed waitresses.

Michael calls over his head chef Raul: together they're going to cook me a bowl of chilli. Because this is Mi Tierra, that bowl has a capacity of 12lb. "Tex-Mex is about a lot of food and big flavours," says Michael, stirring a pan of blood-red slurry. "Fresh isn't always best: in here we've got chilli anchos - the dried form of the poblano chilli, soaked in water for an hour. No tomatoes - this is where the colour comes from." Mi Tierra's chilli recipe, set in stone by his grandmother and her sisters, allows for no other variety. The restaurant now gets through three tons of it a year.

Before Columbus arrived, Michael tells me, people here ate chillies, but not chilli. "They didn't have cheese and they didn't have cumin." Ah, cumin - the Arabic spice with that redolent whiff of a cowboy's armpit, a definitive component of any chilli. "But mainly, they didn't have carne." Even after the Spanish introduced edible livestock, chilli was a poor man's meal, a way of making poor man's meat palatable. "The chilli queens would have used whatever they could get, cuts the butcher threw out. And always in chunks, because who had a mincer back then?" Venison, pork and goat were widespread options; chilli con turtle was not unknown. A lot of cowboy chilli was made with buffalo, back when the pioneers were slaughtering them for their skins. "They dried it into bricks and kept it in their saddlebags. Boil it up on the fire, throw in a few chillies and you're good to go."

Mi Tierra likes to simmer its chilli for four hours, but after one I'm too hungry to wait. Michael reluctantly assents, but then does something terrible: he ladles out a portion onto a red tortilla, rolls it up and smothers the ensemble in grated American cheddar. This, I realise, is how most chilli is now eaten: Mi Tierra's extensive menu only features it served inside or on top of something else, and buried under Monterey Jack. It tastes utterly wonderful - smoky, rich comfort food - but at the same time, it's not a bowl of red.

On a weekend afternoon in Austin, the middleaged locals were hitching pleasure craft up to their SUVs and heading out to the lake. Here in San Antonio, they're dancing in the street. Even better, they're cooking chilli in it. The market square outside Mi Tierra is suddenly alive with noise, colour and the aroma of muscular street food: the city is out in force to celebrate its Hispanic chilli queens, whose saucy banter and impromptu singalongs made every night a street party - until the 1930s, when the civic authorities despaired of their ribaldry and laissez-faire approach to food hygiene.

The annual Return of the Chili Queens festival seems to transplant this whole end of town south of the border: there are stalls selling the full, mad range of Mexican wrestling masks, and the sombrero-topped mariachi troupes stationed outside each restaurant somehow succeed in exuding an air of sombre artistry. But look and listen more closely and you'll spot the Tex-Mex cultural collisions. The craggy Charles Bronson vaqueros, Hispanic cowboys with their fancy rodeo shirts and Stetsons, and the Tejano bands playing the mix-and-match sound of chilli: shades of country and western, mariachi, blues - even a dash of Bavaria with the accordions.

Chilli's more usual sensory associations draw me to the far end of the square, where a row of jolly and pink couples are toiling away at little camping stoves in the mighty midday sun: the Chili Appreciation Society International has come to honour the chilli queens with a cook-off.

Competitive chilli-making is a very Texan concept, one unsurprisingly spawned by a feud. Held in Terlingua, Texas, in 1967, the debut cook-off was organised to settle a score between the embryonic CASI and an East Coast food writer who reviewed their champion's effort as "Texas mud pudding" in an article boldly headlined Nobody Knows More About Chili Than I Do. If I reveal that his own recipe included beans, you will know who won. One of the three judges ended up on the floor in convulsions.

These days, CASI takes itself much less seriously, cooking chilli to raise money for charity and have a laugh while doing so. Powdered spice abounds, and most entrants have a shot of tequila in one hand and a carton of pre-blended Knorr stock in the other; it's all cheerfully reminiscent of the way chilli is made in homes the world over. "Right back to the chilli queen days, this has always been a social meal," CASI director Robert "Wappo" Schrade tells me, "something people enjoy making and eating together." Still, you can't make chilli in Texas without a list of rules, and CASI's regulations proscribe marinading, tomato in any form but purée, the discharging of firearms while at the stove - and beans.

In the spirit of welcoming souls who have been drinking all day in the sun, CASI's senior members insist that I stay to help judge the final. I'm given a scorecard and a stack of plastic spoons, then seated at a table full of similarly inexperienced adjudicators; when I ask my elderly neighbour what he looks for in a chilli, he whispers, "Hell, I'm an Indian. I never eat this stuff!" Sure enough, his debut spoonful sends him into a fearsome coughing fit. "Only 20 to go," whispers Wappo.

My hardened palate laughs off the heat, but struggles to differentiate one spoonful of domesticated red from the next. In fact my only strong opinions are reserved for two duffers, which makes the final results fascinating: the burnt one breaks the top 10, and the one that stank of cats is only one off the podium. "All down to individual taste," says Wappo. "No such thing as the perfect chilli." Happily, he's wrong.

If the story of chilli is the story of Texas, the whole book is neatly abridged in the Hill Country, the rolling uplands north of San Antonio. Here, in the town of New Braunfels, German immigrant William Gebhardt marketed the first commercial chilli powder, thereby propelling a homespun local dish on the road to world domination. And it was in Bandera that the Great Western Trail began, and with it the cult of the cowboy: 300,000 head of longhorn cattle, most rustled from Mexico, herded through its broad main street every year in the 1870s and '80s, a last staging post to stock up on liquor and chilli brick before the long, hard ride to Dodge City, Kansas. And it's here, at the rambling and thrillingly authentic Dixie Dude Ranch, that I am inducted into that cult, riding my palomino slowly through the herds of longhorn for hour after hour.

As viewed through a windscreen, the Hill Country seems full of plump oak trees and well-watered meadows, almost European in aspect. It's hardly a surprise to learn that the region is now better known for its wine than its beef. But from the saddle and far into the heart of the Dixie Dude's 750 acres, I'm looking at a landscape crafted by Wayne and Eastwood: dried creeks, prickly pears, untamed, unpeopled hillsides of brush inflamed with a red-orange covering of the flower known as Indian paintbrush.

The sun is high when our column ambles out of the corral, the shadows long when we return, past the barn that's home to a wagon, the very one the current owner's grandfather drove in when he bought this place in 1901. I creak down from the saddle, hot and hungry, pull my Stetson-substitute cap down over my eyes, then stroll languidly towards the verandah shade, and a table where a glass of lemonade waits by an enamel bowl. Chilli, prepared to a recipe finalised in the kitchen here a century back, seasoned with the pequins and japones that gleam fiercely in the bushes behind the ranch-house, like rubies in the dust. Without raising a fork, I know I'm never going to find a better bowl of red.

Tim Moore is the author of Do Not Pass Go and French Revolutions, among others.

The article 'In search of the perfect chilli con carne in the heart of Texas' was published in partnership with Lonely Planet Magazine.