Basically what happened is decades of underinvestment.
To expand on this point a bit more from the perspective of a long-time frequent bahn traveller and ProBahn supporter: the causes of the present state of the railroads are in fact predominantly political.
In the beginning, in the 1990s, there was the politically imposed neglect of the network in the west in favour of the reconstruction of the desolate network in the former GDR, so that necessary investments in the west were also omitted.
Around the turn of the millennium, the then social democratic government tried to get rid of the Bahn, which was constantly piling up new debts, by privatizing it. To this end a manager was appointed, whose greatest merit was his political affinity to the governing party, but who was otherwise an expert in the concrete market. He, in turn, hired a new management preferably consisting of people from the Lufthansa and other airlines; hardly anyone understood anything about reailroads. This group presented a plan to largely abandon the rail network except for a kind of ring Munich-Stuttgart-Frankfurt-Cologne-Hamburg--Berlin-Leizip- Nuremberg-Munich, with short branch lines from these hubs into the countryside. Public resistance was insurmountable, and so a Plan B was implemented to improve the railroad's balance sheet for a stock market launch, namely, the elimination of all supposedly superfluous infrastructure, including the abandonment of most of the station buildings and, above all, seemingly superfluous tracks and switches between major stations. The latter operation eliminated most of the redundancy in the system, resulting in the now typical phenomenon that a slightly delayed long-distance train cannot overtake an S-Bahn ahead of it for up to 30 km and thus adds to its delay instead of reducing it. In addition, investments in the rolling stock of the freight branch were cut. In contrast, there was a political initiative to expand local transport, so that today, compared to the turn of the millennium, at least twice as many local trains are running on the network, and this on a reduced infrastructure, resulting in a constant congestion of the main parts of the network.
Third, lack of control. The company DB-Netz, which operates the network, does not see itself as a service provider for the infrastructure rather than as a freely acting operator in a wide variety of markets, and the owner, the federal government, does not prevent it from doing so. And when it comes to rail network maintenance, it has developed an almost perfidious tactic. Instead of maintaining the network out of the (high!) revenues for its use, it regularly plays for time with pending repairs, until finally the federal government takes over the construction costs out of fear of public protests. As a result there are numerous completly unneccesary disruptions in the network. However, DB-Netz have gone a bit too far with this game, so that efforts are now finally being made to return the network back into public ownership.
There is a large number of construction sites at the moment, which hopefully will improve the situation at some point in the future; at the moment, long-distance traffic is suffering the most (punctuality rate just over 60%) while local traffic is more or less stable (over 90%). For the next few years there is only one remedy - allow more time for transfers. And everybody should reclaim rigorously the compensation that is owed for a delay of more than 60 minutes, because if we don't light a fire under the railroad bosses' asses (pardon!), they'll continue sitting on it unimpressed.