The way I look at it: in 2014 an otherwise peaceful Ukraine was invaded by its far larger and far stronger neighbor who entrenched themselves after robbing a bunch of territory on a pretext. Ukraine learned the hard way that they were underprepared, changed tactics and dramatically improved their military, while at the same time due to internal issues (mostly corruption) their larger neighbors saw the quality of their army decline.
Then, in recent times Russia decided that just having the Eastern part of Ukraine wasn't enough because those pesky Ukrainians were showing other countries in their sphere of influence (notably: Belarus, Georgia) that it was possible for a country to lift itself out of poverty by aligning with the West.
A complete lack of realistic estimates of operational readiness, underestimation of the Ukrainian resolve and a significant propaganda effort later the larger neighbor decided to finish what they started in 2014, which is roughly where we are today.
The West obviously stands a lot to gain from Ukraine not ending up in the same way as Belarus and so has a strong motivation to ensure that the new Russian imperialist effort fails. This, plus the fact that housing another 40 million refugees is not an option suffices to explain why the West is fairly eager to support Ukraine in its defense against Russia.