Bonn was the de facto capital of The Bonn Republic for forty one years, as well as, for nine years, The Berlin Republic. It's also known as "A Small Town in Germany", from the title of a John le Carré novel which is set in Bonn.
After the war, the division of Germany - and Berlin itself - was expected to be a temporary arrangement, and the West German government were wary of choosing one of the bigger cities as capital - Hamburg, Cologne, Frankfurt or Munich, for instance, in case it looked like they were accepting the status quo.
So Bonn got the job, largely through the lobbying of West Germany's first Federal Chancellor, Konrad Adenauer, who was from Colognenote and was living in a village near the city at the time, and thus just so happened to have a house in commuting distance. The vote which decided against Frankfurt (which had been the site of the first German constitutional convention during the Revolutions of 1848) was Decided by One Vote. The public dryly referred to it as the Bundeshauptdorf (Federal Capital Village). It was widely regarded as a place politicians went to seal themselves away from German culture; even the politicians themselves joked about "Raumschiff Bonn" (Spaceship Bonn). While this is an obvious exaggeration (Bonn had a preexisting population long before becoming the capital), to find any major cultural events you did have to travel a few kilometers northwest to the much larger Cologne.
The West German government had to put up with a motley collection of temporary and converted buildings for decades, because building new purpose-built governmental headquarters might likewise signal the final acceptance of a divided nation.
The West German government finally gave up and commissioned a "proper" governmental quarter complete with a "Museum Mile" - in the late 1980s, just before the wall fell.
Since the reunification, it's managed to retain about half of the government jobs (too expensive to move in many cases). Much of the "new" governmental quarter has still never been used. Due to its history as German capital the city is allowed to call itself Bundesstadt (Federal City) although it has always been a part of the state of North Rhine-Westphalia rather than a city-state like Berlin or Hamburg or a New World-style federal district like Washington, D.C., Canberra or Brasilia.