A lexicon of passing clouds, veiled suns and reflections on water. Early-1960s newspaper photos of murdered student nurses, which once ended up in a Gerhard Richter painting. A family snap of Uncle Rudi, proud in his army uniform; crinkle-edged postcards and pictures from other people's family albums. Mountains and aerial views of cities, and similarly hovering views of towns that exist only as architects' models. Portraits of famous dead men, of Hitler at dinner, of Mao like a babyish, grey, blurred blob. Flowers, some wilting.

This is an image-hoard. Shown for the first time in Britain, Richter's Atlas fills the Whitechapel Art Gallery in London. There is also a small selection of Richter's paintings. Dispersed through the gallery, they pace Atlas, just as Atlas paces the development, and the subjects, of Richter's painting in all its variety and modes.

It goes on: country lanes winding between cornfields, corpses piled in the road with vultures waiting. Mothers and babies and a food-spattered toddler trapped in his high chair. Innocent things: a toilet roll dangling in cool morning light, an acrobat diving, stags at bay. And guilty things: two women doing something with a cucumber, a man doing something to another woman with a length of pipe, a woman sucking a man's penis, a Nazi hanging a boy who has something almost like a smile on his face. Humiliated Jews, the camps. Emaciated victims in the hut, touched up with vivid happy colours. Photos of trains going by near the artist's studio in Cologne. Is it now possible, in Europe, to watch trains without thinking where the lines once led? Is it possible to look at so many images - whether mundane, or titillating and pornographic, or inhuman and horrific and filled with despair - without becoming aware of just how much we like to look, that looking drives us where it will, that we keep on looking?

Atlas is an ever-growing bank of images, encyclopedic, compendious. Many of the photographs were taken by Richter himself, while others are re-photographed images whose origins slip away the more they have been reproduced. Arrays of standard processed snapshots - ordinary, inartistic photographic information that could have come from anywhere - have found their way into this vast cache, including close-up details of the artist's own brushwork and pictures of his children and grandchildren. The anonymous and universal vie with the personal and sentimental. Most images that have found a place here never migrate beyond it. Stalled images, then: some suspended in groups and others lain out singly, all behind glass in identically sized frames, then ordered and presented in juxtapositions that, the artist has remarked, are sometimes "weird and seemingly cynical".

Some groups contain material collected as a resource for specific paintings. At one point Richter, obsessed with Caspar David Friedrich's painting of a ship mired in a frozen sea, travelled to the pack ice and icebergs off Greenland and took numerous photographs there. These colour works are now presented in a huge block of images that fills a wall of the smaller upstairs gallery at the Whitechapel. Other groups stand out, such as the magazine photographs and police archive documentation related to the lives, imprisonment and mysterious deaths of the Red Army Faction in jail, for Richter's most important ensemble of works, titled October 18 1977. Certain images erupt from the wall as we scan. There are stories here, chains of coincidence, runs of images like repetitive thoughts that won't go away.

Atlas has been presented in exhibitions around the world since 1972, although Richter began to compile and order his stockpile a decade before, soon after his move to the west when he was 30. He has continued to add to his Atlas to this day. It has been in a work in progress for more than 40 years, its origins lying not so much in his art as in a job he once had as a darkroom assistant to a commercial photographer.

Richter is one of the world's leading painters, if not the most impressive painter working today. He is also a somewhat bewildering artist, in that his work ranges from portraiture to thickly worked, agglutinative abstract paintings, from intractable monochromes to softly focused, photographically derived landscapes.

Always preoccupied with questions of subject matter, and of manner and genre, Richter has continually asked himself the most basic and fundamental questions an artist, working alone in his studio, can ask: questions of what to paint as much as how to paint. These, one might say, are the first things an artist might ask right at the beginning of a career. They are the questions a child often asks: what shall I paint, what shall I draw? That the artist, now in his 70s, is still faced with what I regard as an existential as well as a creative problem is one of the keys to his art, as well as being its submerged subject.

Born in Dresden in 1932, Richter moved to West Germany only months before the erection of the Berlin Wall. His formative years were spent under not one but two totalitarian regimes, National Socialism and East German communism. He came from what he has described as a pious family. Moving to Düsseldorf in 1961, he found himself in a Germany preoccupied with forgetting, or, perhaps more precisely, repressing its own recent past, suspended in a state of moral ambiguity. All of which has led Richter to distrust ideologies, and to make an art that is the product of doubt and ambiguity - that also defines what artistic freedom he sees himself as having. It is worth adding that Richter's art is extraordinarily tough-minded.

What Atlas shows us, cumulatively, is an entire world of images, some of which Richter regards as unpaintable. A dozen years ago, Neil Ascherson wrote: "Richter's sensibility, although it is in many ways carefully unpolitical, is a product of this endlessly idealistic, endlessly disillusioned Germany."

The key word is Ascherson's repeated "endlessly". Images, too, are without end. Walking among the banked grids of Atlas, one has a growing sense of their proliferation, of Richter's logic and also of the randomness and multiplicity of the world, its intractability. But there is also a growing sense of Richter brooding, brooding over the images that have made their way into Atlas. It is a dark undercurrent in his art. Richter's fellow East German and contemporary, Sigmar Polke, seems to me to evince the opposite in his art, a kind of hysteria.

Ascherson also wrote of what some people saw as Richter's inner coldness and indifference. For all the hot colour in certain Richters - his sunny landscapes, his broken-textured, scraped-over abstract paintings, his colour charts - there is something one might describe as a chill, an inner greyness. And, ultimately, Atlas might seem to be a product of indifference. Or is it that photographs themselves provoke indifference?

What appears as Richter's distance - a wariness and inconclusiveness, a blurring and shadowiness in his portraiture, his cityscapes and still lives - can also be read as a kind of terrible doubt, which goes beyond painting itself, and beyond his painting's frequently close relationship to photography.

Richter once said: "The image of the artist as a misunderstood figure is abhorrent to me... I'm increasingly in favour of the official, the classic, the universal." This I take as a kind of provocation. To those who cling, however naively, blindly or idealistically, to an idea of an avant-garde pitched against the "official" and the "classic", this is anathema. In some quarters Richter has come to be regarded as a pompier painter, a bourgeois salon painter for the kind of society that a more "committed" art should be pitted against. But Richter has always been too complex a painter, and a thinker, to fit so simplistic a view.

What Atlas shows us (and what his greatest work, the Baader-Meinhof October 18 paintings, also shows us) is an artist committed not to his own aggrandisement or to bolstering society, but pitted, rather, against indifference, and against the numbness of the world. He is also, in a certain way, fiercely mistrustful of images and what they convey. Some photographs, especially those of the Holocaust, are irreducible, and perhaps unpaintable in themselves. He keeps picking them up and putting them down again. You can tell he is in there, thinking them through and unable to think about them. When we look at them, we do the same. And do our own brooding.

· Gerhard Richter: Atlas is at the Whitechapel Art Gallery, London E1, until March 14. Details: 020-7522 7888.