Bonds follow the rules of supply and demand like any other product. When the risk/reward story for stocks deteriorates money migrates to bonds. The lower rate on extended maturities tells you more and more capital is looking for safety.
One reason inversions happen is because investors are selling stocks and shifting their money to bonds. They've lost confidence in the economy and believe the meager returns that bonds promise might be better than potential losses they could incur by holding stocks into a recession. So demand for bonds goes up and the yields they pay goes down.
This widespread loss of confidence explains why inverted yield curves have proceeded every recession since 1956. The last inversion began in December 2005 and heralded the Great Recession, which officially began in December 2007. Then came the 2008 financial crisis. There was also an inversion before the tech bubble burst in 2001.
https://www.google.com/amp/s/www.cnbc.com/amp/2019/08/14/the-inverted-yield-curve-explained-and-what-it-means-for-your-money.html