Why do people buy negative interest rate bonds? I get that people buy long term government bonds, because of how safe it is, and if there would be a recession the government would just print more money and could pay it back. 

But why would anyone buy a bond, that yields a negative return? If i would just keep my money in fiat, it would just depreciate in the 10 years, but after the 10 years it would still be more than investing it in a safe negative rate.
Some pictures and text are from Schroders, Marketwatch and other websites, but I don't remember all them.
Of note, Germany first sold negative-yielding bonds in Aug 2019, €2bn worth of 30-year bonds that offer no interest payments at all.
1. Better than holding cash
Cash is obviously most liquid, but some central banks like Japan impose negative interest rates on cash deposits, which trickles to the rate banks charge institutional investors.
Then highly liquid but only slightly negative yielding government bond looks better! Because the UK government unlikely will default, bond buyers are just paying a small sum to the government to guard your money, like in a vault!
2. Wagering that there are other “bagholders.”
Investors who buy negative-yielding bonds are betting on the value of the securities to keep rising. Although investors buying bonds with subzero interest rates are paying for the privilege to hold a bond, they can profit way above their cost if the security’s price rises.
For example, if you expect a central bank to buy more assets,  bond buyers can rely on the central bank to hoover up their negative-yielding securities.
In July 2020, an auction for €4 billion euros of 10-year German government bonds TMUBMUSD10Y, 0.644% sold at $-0.26%$, but at a premium price of 102.6 cents to the euro. The benchmark bund is now trading at a price of a 106.9 cents to the euro,. So  investors who bought this at auction would've gained around 4% from the price increase alone.
3. Bonds as deflation hedge
When prices fall, most asset classes don't perform well in deflation. An exception are fixed interest government bonds! Because they fixed  their coupon and principal, they retain their value and will positive real (inflation-adjusted) return, if inflation $&lt;$ their yield. In other words, a negative yielding bond can  positive real return if there is deflation. So you can hedge against deflation with negative-yielding bonds.
4. Currency hedging can transform negative yields into positive yields.
Negative yields don’t mean negative income for some bond buyers. Unlike European and Japanese investors, US investors are often paid to hedge against fluctuations of foreign currencies because U.S. interest rates are much higher than in other developed markets like Europe and Japan.  Currency hedging can annualized return 3% for U.S. investors, like  American fund managers, buying negative-yielding  euro-denominated debt like European government bonds, according to Jens Vanbrabant, senior portfolio manager at Wells Fargo Asset Management.
In Sep 2009, the 10-year German Bund yield at -0.6% looked unattractive to US investors.But currency hedging is priced at the difference between US and German short term interest rates, which can be positive even if a central bank cuts interest rates. Since US short term interest rates are much higher than Germany's, US investors are paid money to hedge euro exposure! With currency hedging, US investors can earn 2.2% when investing in German 10 year bonds (see Figure 2 by Schroders), higher than the 1.6% available on US 10 year Treasuries.

5. Diversification benefit
What other bolt holes can weather volatile global equity markets, Brexit, US-China trade war?
Traders like volatility to a degree, but they try to diversify the risk so their portfolios aren’t fully exposed to the market's unpredictability. So buying notoriously safe bonds is a risk-averse strategy. You'll lose some money for that safety, but that loss can constitute ‘over-performance’ if other asset classes tumble. When risky assets sell off, negative yields on government bonds may be overshadowed by their proven ability to rally during recessions. Even at negative yields, bonds still are important. Figure 3 by Schroders  proves the 3-year rolling correlation between German Bunds and the German DAX stock market index. The two strong negative correlated, if you overlook the period between 2014 and 2017 when the European Central Bank’s (ECB) quantitative easing raised higher bond prices (lower bond yields) and higher stock prices.

Bonds  perform well when equities don't, vice-versa. In times of distress, you must reduce risk like this! If you are running for safety,  capital leave stocks to government bonds. Even if negative-yielding bonds lower your return compared to normal conditions, they can still reduce portfolio risk.
6. Roll down the yield curve later.
You're assuming the bondholder is holding it long term, but many don't.
In periods of uncertainty, demand for bonds increases, which makes their price increase. So you can profit from buying and selling government debt. If you think this  volatility will last, buy bonds now in the hopes that more investors flock to them later. You don't even need fellow investors to buy them! The central banks may be the ones to buy bonds to try to stimulate the economy.
Bond buyers can take advantage of the yield curve’s slope, which still can be steep even for negative-yielding bond markets in Germany and Japan. For example, a trader can buy a negative-yielding 3-year bond and sell it after a year. Since debt prices inversely correlate with yields, all else being equal, the value of the 3-year bond should be higher than, for example, a 2-year bond.
So long as shorter-term bonds' interest rates are more negative than their longer-dated counterparts,  the long-term bond's price should rise closer to maturity. But they can profit from this “rolling down the yield curve” as a short-term strategy, and must sell the bond well before maturity, because the bond will trade only at par when it expires.
For example, the Swiss 10-year bond was yielding -0.1% in Jan 2009. But at 22 August 2009, it had returned 5.6%! Negative yields can still positive return! Of course, this works both ways. Any rise in yields can make you lose money.
7. Some institutions are legally required to buy bonds! Liability matching with negative yields
The other reasons are about speculation or managing risk. But institutions can be legally mandated to buy bonds with negative yields.
Certain institutions must follow rules dictated by the banks, pensions funds or insurance companies who provide the bulk of the capital. Those rules mandate the managers to invest just in certain things like investment-grade bonds. Regulators force some clients to buy certain assets, like banks can only buy liquid assets.
Liability-relative investors, such as insurance companies and pension funds, don't care the absolute return or yields from bonds. They often buy bonds to “match”  their liabilities. The present value of these liabilities is calculated in many ways, but factors in government bond yields. For example, in Sep 2009 in the euro area, insurance industry used negative rates up to the 11 year maturity point (Source: EOPIA. See data from 31 July 2019). These liability-driven market participants can buy negative-yielding German Bunds to match a future liability . Their values will move in tandem with each other.  If they don't buy negative matching assets, they'll be exposed to significant risks if interest rates fell further.