'Whenever a country produces a man of genius," said WB Yeats of his friend John Millington Synge, "that man is never like the country's idea of itself."

Ireland in 1907 saw itself as ready for self-rule and it expected its artists to promote the image of a steady, sober, self-reliant people. Instead, with The Playboy of the Western World, Synge gave them a play in which a village loon splits his father's head open with a spade, runs away, tells people he "killed his da" and is promptly installed as a hero by excitable women and drunken men. Worse still, this drama was staged not in some backstreet art-house, but at the Abbey, Ireland's national theatre, one of whose mission statements was to show that Ireland was not the home of buffoonery but of an ancient idealism.

Even before the opening night of Saturday 26 January 1907, trouble was brewing. Synge's relation with nationalists had always been uneasy. They didn't like the frenchified themes of his earlier plays such as The Shadow of the Glen, in which a frustrated young wife in the Wicklow mountains walks away from her home and marriage into the arms of a tramp whose name she doesn't even know.

Nationalists also resented the implication behind the Abbey project that there could ever be an Irish national literature in English, the language of the coloniser. Synge believed that there could, albeit in an English as Irish as it is possible for that language to be. So he created sentences in which standard English was reconfigured by peasants who were thinking still in Irish: "Is it you that's going to town tomorrow?" "Is it tomorrow that you're going to town?" Emphasis is achieved not by tonal underlining but by bringing the key word forward to the start of the sentence.

His labours to appease Irish Ireland were in vain. Protesters against his new play uttered "vociferations in Gaelic", according to newspaper reports. They insisted that the Irish were not by nature a violent people – and on the second night they stormed the stage and rushed the actors to prove their point. Some of the actors were in silent agreement with them. The Abbey had, after all, recruited many stalwarts from the ranks of advanced nationalism, who had joined in the belief that it was one of the few liberated zones in an occupied country. No wonder that members of the cast felt conflicted. One Abbey hand had warned that the bad temper and violence on stage (the Playboy tries to repeat his murder before being burned by a lighted sod) would inevitably spill over into the pit.

Throughout Ireland, in the aftermath of the Playboy riots, local councils passed motions condemning the Abbey. Catholics took particular offence at the way in which a writer of Protestant Ascendancy background causes the Playboy, Christy Mahon, to utter such imprecations as: "With the help of God, I killed him surely, and may the holy immaculate mother intercede for his soul." But others were outraged too. Some writers who had admired Synge's earlier work felt that now he had gone too far. "It is not against a nation that he blasphemes," wrote Patrick Pearse in a journal of the Gaelic League, "so much as against the moral order of the universe." The Irish Times's critic identified one cause of the trouble: "It is as if a mirror were held up to our faces and we found ourselves hideous. We fear to face the thing. We scream."

Synge had some idea of what might happen. "My next play will make them hop," he promised a friend. The role of Christy Mahon, father-slayer, was played by an actor who was the Woody Allen of the theatre, no more than five feet three inches in height and one normally cast in comic roles. It is a mark of the mediocrity of life in the Mayo village that peasant girls can turn such an unpromising figure into a celebrity. Christy provides a blank space which they can fill with their dreams.

At the centre of the play is a clear implication that the besetting vice of the Irish is not pugnacity but paralysis – a point made in the same period by the young James Joyce, in those short stories which would be published (after delays) as Dubliners in 1914.

It was predictable that ancient Gaelic hero-cults would flourish against a backdrop of social poverty and colonial torpor. The most notable of these surrounded the epic warrior Cuchulain, who fought and beheaded enemies in single combat, before dying strapped to a pillar while a raven drank his blood. That blend of pagan energy and Christlike suffering must have struck Synge as ridiculous. It was as if the Irish were being allowed to find only in the remote past a disguised version of the "muscular Christians" of the imperial present, a Celtic hero who was really just a public schoolboy in drag.

The audience at the Abbey on the opening night was predominantly male. Its members were already committed to the fabrication of male heroism through the Cuchulain texts of Yeats and Lady Gregory, which they saw as offering an antidote to the triumphalist militarism of the British imperial army.

Yeats was away in Scotland at the outset and Synge laid low with flu. Thinking all well, a relieved Lady Gregory (who didn't like it at all) wired Yeats: "Play a great success." Her next telegraph was different: "Audience broke up in disorder at the word shift."

What offended were lines in which Synge had remodelled a scene in the life of Cuchulain. In the epic the hero underwent a "battle rage" after fighting, which so terrified his comrades that they would not permit him to reenter the city of Emain Macha. Eventually, they solved the problem in high style: 30 virgins were sent naked across the plain of Macha, walking towards the hero. Being a bashful lad, he blushed, bowed low, and, so the manuscripts say, "with that his battle rage left him".

Rage turned to riot when Christy voiced his love for the publican's daughter in a reprise of that scene: "It's Pegeen I'm seeking only and what'd I care if you brought me a drift of chosen females, standing in their shifts itself maybe, from this place to the Eastern World?" Synge had clad his maidens in shifts, presumably to mollify strict moralists among his Abbey audience. But perhaps he half-suspected a truth which Hugh Hefner would later turn into a different Playboy business: that a scantily clad woman can be even more inflammatory to the jaded imagination of male puritans than one who is wholly naked.

The Russian writer Maxim Gorky found in the play "a subtle irony on the cult of the hero". So did, in all fairness, many of the rioters. They were not fools or knaves, but proud, clever people, some of them leading public intellectuals who knew that their deepest convictions were being thrown into question.

Some may have felt that their very virility was being mocked. Synge's play, like earlier dramas of Shaw and Wilde, is filled with gender-bending, based on the theory that womanly men are attracted and attractive to manly women. Christy's delicate feet are fetishised by women who seem far more muscular than any man in the village. When some women catch Christy preening himself in a mirror, it is as if Synge is inverting that ancient pictorial tradition whereby a male artist placed a mirror in the hand of a female (who held it up to her face in a painting titled Vanity). Now, it is Christy who is tokenised as sex object and toyboy by village girls. As he holds the mirror shyly against his back (effectively holding it up to his own bottom), the women giggle: "Them that kills their fathers is a vain lot surely."

If psychologists are right to say that the sense of masculinity is less strongly rooted in males than that of femininity in women, then it's not surprising that members of the audience tried to vindicate their manhood by throwing punches or emitting howls. On Monday 28 January 1907 the play was mostly inaudible amid shouts of "kill the author". On Tuesday a returned Yeats not only called in the Dublin Metropolitan Police ("Know I would accounted be / True brother of the DMP") but identified for arrest those intellectuals whose names he knew. Outside, the young Sean O'Casey, who couldn't afford the shilling admission fee, was pushed back and forth by what he called "Gaelic Leaguers foaming at the mouth".

Synge insisted that his plot was not to be taken as social realism. Rather it was an "extravaganza", a semi-abstract account of what he called "the psychic state of the locality". The word "shift", he pointed out, had been used without offence in Love Songs of Connacht, a best-selling collection edited by – of all people – the president of the Gaelic League. But then perhaps, he waspishly added, you could get away with things in Irish that you couldn't smuggle through in English. In similar mode, he once delighted a hospital doctor by saying as he emerged from an anaesthetic: "May God damn the bloody Anglo-Saxon language in which a man can't swear without being vulgar."

Certain contemporaries thought that Synge was hurt more by the controversy than he pretended. That seems unlikely – he gave as good as he got, and then some. His own family turned a blind eye to the row. A nephew recalled that the morning after the riots, when papers were filled with reports, Synge's mother disdained even to mention the topic. She never recognised his career or his genius.

Two years later, he was dead – but The Playboy was soon to go global. Abbey actors who brought it to the US were arrested. Back in Ireland, that same Patrick Pearse who had called for a boycott of the Abbey now began to identify with Synge, as he rehearsed his own martyr's role as leader of the Easter rising. By 1913 Pearse had revised utterly his image of the playwright, describing him as a patriot who baffled his people by using images which they could not understand.

In the wider world, The Playboy was soon recognised as a masterpiece. A play about parricide, appearing just after Freud defined the Oedipus complex, was destined to fascinate. Antonin Artaud saw it as the true origin of the theatre of cruelty. The young Jean-Paul Sartre insisted on taking Simone de Beauvoir to repeated viewings, so that she might understand the existential values of a protagonist without filial obligation who "wished to derive only from himself". Among socialists such as Bertold Brecht Christy was treated as a proletarian insurgent against a corrupt order, though Synge's irony at the making and unmaking of celebrities may also inform one of Brecht's most cited exchanges: "Unhappy the land that has no hero. No; unhappy the land that needs a hero. "

In Trinidad in the 1980s, Mustafa Matura rewrote the text as The Playboy of the West Indies. More recently, back in the Abbey, a Nigerian Christy from the pens of Bisi Adigun and Roddy Doyle is a new, urban, multicultural take on the old story. But the real author, like the true playboy, was Synge. As Bernard Shaw said: "His libel on Ireland was really the truth about the world."

Not that everyone has loved it. When it was finally staged in the west of Ireland, audiences were bored rather than annoyed, saying that "You could see the like of that carry-on any day in the pub." The dismissive view has had some distinguished overseas supporters. The poet Philip Larkin downed a second gin-and-tonic during the interval of a performance in the Oxford Playhouse, decided that it was "all balls" and didn't go back for the second half. But then he didn't need a Synge to tell him what your dad can do to you.

The Playboy of the Western World is at the Old Vic, London SE1, until 26 November. www.oldvictheatre.com