Spoiler below:
In (one of) the ending of "Das Boot", the submarine finally makes it back home to a welcoming ceremony, and moments later an allied bombing raid catches them completely by surprise and destroys the dockyard.
To me it seemed a bit inprobable that the planes could just swoop down, unseen and unopposed, and wreck a (very?) important military installation.
For late 1941, the ending showing an RAF raid of such destruction was not really possible. RAF daylight raids over France in this period were seldom very dangerous to those on the ground. Some were pinprick raids, codenamed Ramrod or Circus, that had a heavy fighter escort and whose aim was to destroy the Luftwaffe in the air instead of destroy targets on the ground. RAF attacks on ports, which were heavily defended were decidedly ineffective. In a July 1941 raid on Brest, Operation Sunrise, over a hundred RAF medium and heavy bombers attempted to damage the heavy German surface ships in the port, but only achieved minor damage to the ships and facilities, at a cost of twelve bombers. Other daylight raids on ports achieved similar negligible results in 1941. Even worse for the RAF, the Todt organization was completing a series of massive U-boat pens of reinforced concrete that were highly resistant to the existing size bombs. The RAF launched its own program of bunker-busting bombs, Tallboy and Grand Slam, that could penetrate these ferroconcrete structures, but these munitions were not ready for operations until 1944. Thus both the film and novel's depiction of an RAF bomb penetrating a u-boat pen in 1941 is a clear embellishment.
In defense of Lothar Gunther-Buchheim and the adaptation of his novel, the overall narrative of the titular boat was supposed to be a placeholder for the entire u-boat arm. Buchheim was a war correspondent on U-96, and one of its patrols provided the skeleton of the novel's narrative. U-96, for example, did encounter another u-boat in middle of the storm, and did try to break through Gibraltar and failed after an attack by a radar-equipped aircraft. One of the overarching themes of Das Boot was that while the British learned from prior mistakes and got better at ASW and convoy protection, the u-boat arm atrophied on the laurels of prior successes. By later 1941, it was increasingly clear that the Type VIIs had problems with the newer generation of escort ships and tactics, and that the presence of Allied aircraft was becoming a major problem. The loss of Günther Prien and other early war commanders in 1941 prompted concerns about this growing gap between Allied and German capabilities, to which Dönitz often responded to with entreaties against the flagging fighting spirit of the commanders, in effect, shooting the messenger. Such slights rankled with veteran commanders like Heinrich Lehmann-Willenbrock, Der Alte in the film and book. As the tide decisively turned in the Battle of the Atlantic over the next two years, The Kriegsmarine retired a number of these veterans in favor of younger, allegedly more aggressive commanders, in a vain effort to restore the "Happy Days" of 1940.
So while much of Das Boot is a very heavily embellished and fictionalized tale of real events, there is a degree of accuracy in it, even when it portrays implausible turn of events. While damage from air attack was only an emerging threat in 1941, it was a threat, as evidenced by the failure of U-96's breakthrough to the Mediterranean. Air attacks at sea were an issue in 1941, but by 1942 and 1943, they were an ever-present reality for the U-boat arm. While Allied bombing raids could not penetrate u-boat pens until 1944, raids only grew in scale as the war went on and destroyed much of the surrounding port facilities. German airpower helped denude the Ramrod and Circus raids of their efficacy in 1941, but it was clear by 1943 that Germany had lost air superiority over France.