Frank Ripploh is fed up. Stuck in hospital for six weeks with some unnamed contagious sexual disease – most probably hepatitis – he receives a visit from his live-in lover. Instead of listening sympathetically to Frank's moans about the other patients, Bernd gives him a right telling-off about his promiscuity: "I hope lying here teaches you something." After Bernd leaves, a furious Frank pulls his clothes on and hails a taxi. There then follows a mad dash around various public toilets. With the meter running, he desperately searches for a quick pick-up and eventually ends up in Berlin's Tiergarten – a large public park near the centre of the city that was a notorious cruising ground at that time.

Here, however, the loo is closed. Frank looks further into the light woodland. A leather queen rests against a tree: after the ritual dance, the two get down to it. As they embrace and play with each other in an ultimately unsatisfying encounter, the burnished golden plume of Berlin's Victory Column rises, so obviously a phallic totem, above the scene. All the while, the taxi meter ticks.

Released in the UK in 1982, Taxi zum Klo was groundbreaking in its unhysterical depiction of contemporary urban gay life. It was part of an international wave of gay films in the late 70s, the most notable of which, from a British perspective, were Derek Jarman's Sebastiane (1976) and Ron Peck's Nighthawks (1978). For Ripploh, Berlin is a gigantic sexual playground, a place where encounters can happen in the street, in the public toilet, at the garage, or even using an early ATM. As he tells Bernd in one of their early arguments: "When I take a walk in the street, it's like an adventure for me, things can happen." But later he expresses the fear that he'll become "an old fag who hangs around in bogs".

These contradictions are explored through graphic depictions of gay sex. These are not idealised – you can see the spots and the pale skin – but they made Taxi zum Klo notorious. It was seized by US customs. Denied a general release in the UK, it was shown on the alternative network that included the Scala, the ICA and the Screen on the Green.

This frankness also tapped into a British fascination with Germany in general and Berlin in particular that peaked in the late 70s and early 80s. Taxi zum Klo shows a neon-illumined city in motion – seen through the rain-flecked windows of Frank's Karmann Ghia. As he drives, he reflects in voiceover while a minimal electronic soundtrack pulses.

The Berlin that attracted British artists was an open city. It was an anomaly, an oasis of extremity created by the cold war. Here, anything could happen. People lived ordinary lives, to be sure, but we see little of this in Taxi zum Klo: Ripploh's Berlin is peopled with bohemians and outcasts who enact a fragile, febrile freedom in their various ways. It's a film that sets bursts of colour against the drab architecture of the postwar reconstruction.

Taxi zum Klo was released a year after one of the most famous German films of the period – one that again had a big impact in the UK. Premiered in late 1980 and arriving in Britain in 1981, Christiane F dramatised the true story of a 14-year-old girl's descent into heroin addiction. Uncompromising if not relentless, it again presented Berlin as a city of extremes. Parents are almost entirely absent or self-involved. Christiane F focuses on a peer world where teens are free to roam unchecked through a bleak urban environment of dark clubs, neon, concrete, squats and, like Taxi zum Klo, public toilets – although here they are used for an entirely different purpose. The overwhelming tone is dark, ominous, leached out.

This vortex is punctuated and enhanced by sequences that show Berlin in motion. Early on, the progress of an S-Bahn train is soundtracked by David Bowie's V-2 Schneider, while the endlessly receding curve of a neon underpass – seen by Christiane, stoned in the back of a punter's car – accompanies Station to Station, with its percussive motorik stabs. The ominous Sense of Doubt plays over two descents: down an escalator, into a train tunnel. Down, down, down.

Indeed, the big promotional hook for Christiane F was the considerable involvement of Bowie, who supplied nine tracks for the soundtrack (later turned into an album) and who performed one song – Station to Station – on a club set. He is integrated throughout the plot as Christiane's idol, while his cinematic, ambient music provides the film with its texture and emotional depth.

Bowie, in fact, was immersed in the German music of the period, and released his Berlin trilogy – Low, Heroes and Lodger – between 1977 and 1979. Before him, the German bands Kraftwerk and Neu! had perfected a music of motion, of rhythmic repetition that was perfect for travel: Trans-Europe Express, Hallogallo, E-Musik, Autobahn. At the same time, Tangerine Dream refined a series of electronic pulses that prefigured both ambient and techno. During 1975, their mainstay Edgar Froese released his second solo album, Epsilon in Malaysian Pale, which, with its lush, psychedelic dreamscapes, prefigured much of the second side of Bowie's Heroes – V-2 Schneider and Moss Garden in particular.

In January 1976, before moving to Berlin, Bowie had released Station to Station, an album that showed a strong German motorik influence and hinted at his increasing – and on occasion, highly ambiguous – fascination with the forbidden history of Nazi Germany. This had, of course, long been part of Britain's fascination with the country in general, from Christopher Isherwood's Goodbye to Berlin onwards.

The myth of a libertarian city and culture destroyed by fascism was propagated by Cabaret, a 1972 film that had a major influence on glam rock and punk. Some of the first punks were Bowie clones, determined to act out their Weimar fantasies in a Britain they perceived as teetering on the edge of chaos – a mood summarised by Bertie Marshall's memoir, Berlin Bromley.

When Bowie moved to Berlin in late summer 1976, he immersed himself in the city's past – including visits to the Brücke Museum, the home of the early 20th-century expressionist group – as well as its decadent present: his affair with Romy Haag (who is mentioned in Taxi zum Klo) was immortalised in his 1979 hit, Boys Keep Swinging. At the same time, he was beaming into the future. During that year he met Kraftwerk – who wrote about it in Trans-Europe Express – and Giorgio Moroder, who in 1977 would release I Feel Love. The mixture of rhythm, repetition, dreamy textures and simple, romantic synthesiser melodies proposed a new vision of a country divided by naked geopolitics (a fact also dramatised by the Sex Pistols' Holidays in the Sun).

The new German music was saturated in absence, loss and distance, emotional and physical alike. It was withdrawn, alienated, with flashes of beauty. It was also prone to burst into prolonged sequences of machine repetition, where people could dance or travel in technical ecstasy. A new layer of myth and meaning was added to the decadence of the not so recent past. The influence of Low and Heroes, I Feel Love and Trans-Europe Express grew after the "German Autumn" of 1977 – when the struggle between terrorists and state reached its climax. Like punk rock, Baader/Meinhof represented one logical outcome of late-60s radicalism, and for Britons divorced from the reality of their activities, they offered a powerful symbol of a country in crisis.

After punk and Baader/Meinhof faded, a cold wave swept through British pop: Gary Numan, the Human League, Ultravox's Vienna. Berlin cropped up in Joy Division's haunted Komakino and the Mobiles' melodramatic Drowning in Berlin, while Spandau Ballet's name referenced the district to the west of the city. Taxi zum Klo caught this pop-cult cycle as well as the resurgence in German cinema. From the mid-70s on, Wim Wenders made his "road movie" trilogy, as well as The American Friend, while Rainer Fassbinder was at the height of his extraordinary productivity with, in particular, Fox and His Friends (1974) and Berliner Alexanderplatz (1980).

At the end of Taxi zum Klo, Frank Ripploh is left in suspension, torn between his lover and his impulses. The audience now knows that a disaster is around the corner, but he didn't, and this is what gives Taxi zum Klo its poignancy and curious innocence. Frank is a kind of Candide, wandering through a great city that offers opportunities and freedoms that do not quite banish a terrible past.