Few people today visit Utah beach. The sand seems colder and flatter than anywhere else along the Normandy coast where the Allies landed on D-day. The town of Arromanches - a few miles to the east and closer to Omaha, Gold and Sword beaches - is a crowded theme park of war museums, cemeteries and souvenir shops, bunkers and bunting. Guidebooks in hand, tourists edge gingerly around the German gun emplacements and try to imagine what it was like to stare down the gun sights at the vast armada approaching the shore.

But Utah beach, on the western edge of the landing grounds, is silent. A few waves swill over the sand as if too bored to think of anything else. The coastal land seems lower than the sea, and fails to echo the sounds of war inside one's head.

Walking along the beach some years ago, I noticed a dark structure emerging from the mist ahead of me. Three storeys high, and larger than a parish church, it was one of the huge blockhouses that formed Hitler's Atlantic wall, the chain of fortifications that ran from the French coast all the way to Denmark and Norway. This blockhouse, as indifferent to time as the pyramids, was a mass of black concrete once poured by the slave labourers of the Todt Organisation, pockmarked by the shellfire of the attacking allied warships.

A flight of steps at its rear led me into the dank interior with its gun platforms and sinister letter box view of the sea. Generations of tramps had dossed here, and in the stairwells were the remains of small fires, piles of ancient excrement and a vague stench of urine.

At first sight, the blockhouse reminded me of the German forts at Tsingtao, the beach resort in north China that my family visited in the 1930s. Tsingtao had been a German naval base during the first world war, and I was taken on a tourist trip to the forts, a vast complex of tunnels and gun emplacements built into the cliffs. The cathedral-like vaults with their hydraulic platforms resembled Piranesi's prisons, endless concrete galleries leading to vertical shafts and even further galleries. The Chinese guides took special pleasure in pointing out the bloody handprints of the German gunners driven mad by the British naval bombardment.

Years later, in that Utah beach blockhouse, I was looking at similar stains on the concrete walls, but the scattered rubbish and tang of urine made me think of structures closer to home in England - run-down tower blocks and motorway exit ramps, pedestrian underpasses sprung from the drawing boards of enlightened planners who would never have to live in or near them, and who were careful never to stray too far from their Georgian squares in the heart of heritage London.

From the rooftop barbette I looked along Utah Beach towards an identical blockhouse 800 yards away, and beyond that to the faint silhouette of a third. The Atlantic wall was only part of a huge system of German fortifications that included the Siegfried line, submarine pens and huge flak towers that threatened the surrounding land like lines of Teutonic knights. Almost all had survived the war and seemed to be waiting for the next one, left behind by a race of warrior scientists obsessed with geometry and death.

Death was what the Atlantic wall and Siegfried line were all about. Whenever I came across these grim fortifications along France's Channel coast and German border, I realised I was exploring a set of concrete tombs whose dark ghosts haunted the brutalist architecture so popular in Britain in the 1950s. Out of favour now, modernism survives in every high-rise sink estate of the time, in the Barbican development and the Hayward Gallery in London, in new towns such as Cumbernauld and the ziggurat residential blocks at the University of East Anglia.

But modernism of the heroic period, from 1920 to 1939, is dead, and it died first in the blockhouses of Utah beach and the Siegfried line. Yet in its heyday between the wars, modernism was a vast utopian project, and perhaps the last utopian project we will ever see, now that we are well aware that all utopias have their dark side.

Nazi Germany and Soviet Russia were two utopian projects that turned into the greatest dystopias the world has known. Modernism briefly survived them both, but lost its nerve in the 1960s when the municipal high-rise estates in St Louis, Missouri, were deemed social catastrophes and dynamited. However, I sometimes think that social catastrophe was what the dirt-poor residents secretly longed for.

Modernism's attempt to build a better world with the aid of science and technology now seems almost heroic. Bertolt Brecht, no fan of modernism, remarked that the mud, blood and carnage of the first world war trenches left its survivors longing for a future that resembled a white-tiled bathroom. Architects were in the vanguard of the new movement, led by Le Corbusier and the Bauhaus design school. The old models were thrown out. Function defined form, expressed in a pure geometry that the eye could easily grasp in its entirety. Above all, there should be no ornamentation. "Less is more," was the war cry, to which Robert Venturi, avatar of the tricksy postmodernism that gave us the Sainsbury wing of the National Gallery, retorted: "Less is a bore."

But the modernists maintained that ornamentation concealed rather than embellished. Classical columns, pediments and pilasters defined a hierarchical order. Power and authority were separated from the common street by huge flights of steps that we were forced to climb on our way to law courts, parliaments and town halls. Gothic ornament, with all its spikes and barbs, expressed pain, Christ's crown of thorns and agony on the cross. The Gothic expressed our guilt, pointing to a heaven we could never reach. The Baroque was a defensive fantasy, architecture as aristocratic playpen, a set of conjuring tricks to ward off the Age of Reason.

So modernism was a breath of fresh air and possibility. Housing schemes, factories and office blocks designed by modernist architects were clear-headed and geometric, suggesting clean and unembellished lives for the people inside them. Gone were suburban pretension, mock-Tudor beams and columned porticos disguising modest front doors.

Hitler and Stalin were intrigued by modernism, which seemed part of a new world of aviation, radio, public health and mass consciousness. But the dictators were nervous of clear-headed people who thought for themselves. The Nazis promptly closed the Bauhaus when they came to power and turned it into an SS training school.

Modernism saw off the dictators, and among its last flings were Brasilia, the Festival of Britain and Corbusier's state capital buildings at Chandigarh in India. But it was dying on its pilotis, those load-bearing pillars with which Corbusier lifted his buildings into the sky. Its slow death can be seen, not only in the Siegfried line and the Atlantic wall, but in the styling of Mercedes cars, at once paranoid and aggressive, like medieval German armour. We see its demise in 1960s kitchens and bathrooms, white-tiled laboratories that are above all clean and aseptic, as if human beings were some kind of disease. We see its death in motorways and autobahns, stone dreams that will never awake, and in the turbine hall at that middle-class disco, Tate Modern - a vast totalitarian space that Albert Speer would have admired, so authoritarian that it overwhelms any work of art inside it.

Modernism was never popular in Britain - a little too frank for its repressed natives, except at lidos and the seaside, where people take their clothes off. The few modernist houses and apartments look genuinely odd. Why?

I have always admired modernism and wish the whole of London could be rebuilt in the style of Michael Manser's brilliant Heathrow Hilton. But I know that most people, myself included, find it difficult to be clear-eyed at all times and rise to the demands of a pure and unadorned geometry. Architecture supplies us with camouflage, and I regret that no one could fall in love inside the Heathrow Hilton. By contrast, people are forever falling in love inside the Louvre and the National Gallery.

All of us have our dreams to reassure us. Architecture is a stage set where we need to be at ease in order to perform. Fearing ourselves, we need our illusions to protect us, even if the protection takes the form of finials and cartouches, corinthian columns and acanthus leaves. Modernism lacked mystery and emotion, was a little too frank about the limits of human nature and never prepared us for our eventual end.

But all is not lost for admirers of modernism. They should visit the mortuary island of San Michele in the Venice lagoon, where many pioneers of modernism such as Igor Stravinsky, Serge Diaghilev and Ezra Pound are interred. After taking the ferry, you disembark at a gloomy landing stage worthy of Böcklin's Island of the Dead. This is a place beyond hope, of haunted gateways and melancholy statues.

But then, in the heart of the cemetery, there is a sudden lightening of tone, and you find you are strolling through what might be a Modern suburb of Tunis or Tel Aviv. The lines of family tombs resemble cheerful vacation bungalows, airy structures of white walls and glass that might have been designed by Le Corbusier or Richard Neutra. One could holiday for a long time in these pleasant villas, and a few of us probably will.

So, there is one place where modernism triumphs. As in the cases of the pyramids and the Taj Mahal, the Siegfried line and the Atlantic wall, death always calls on the very best architects.