In Germany's case because they saw what happened in Japan and made an adjustment to their projected risk assessments and decided it wasnt worthwhile.
It may have been the wrong decision, especially given the difficulty in measuring the risks involved but it wasnt an irrational decision.
Nuclear power has a small chance of going wrong but when it does it goes very wrong.
And when it did, Japan had to fire up all of its coal and natural gas.
* https://www.enerdata.net/publications/daily-energy-news/germ...
"German energy demand, carbon dioxide emissions seen rising in 2021 -industry group"
* https://www.reuters.com/business/environment/german-energy-d...
"Germany’s energy consumption rising, renewables share falling in 2021"
* https://www.cleanenergywire.org/news/germanys-energy-consump...
I live 50km from a nuclear power plant. I don't worry about it at all.
Climate change is a (existential?) threat to humanity. There is only so much renewable energy generation capacity that can be constructed in any given year. If you shutdown a nuclear power plant, the demand it was servicing does not magically go away. So you need to something to meet that demand: that may be renewable, but if not enough can be constructed, then it could also mean running fossil fuels more.
So if you want to actually treat climate change as an important problem, why would you shutdown non-emitting source of power that you already have?
Keep the existing nuclear plants, shutdown the fossil fuel-based generators, and use the renewable power you're building to offset the retirement of the latter.
Once all your carbon-emitting generators are retired then consider shutting down the non-emitting nuclear generators.
At no point in the above process are new nuclear plants built.