The historical map of presidential elections shows that Virginia was for decades a red state till 2008, when Obama won this state. Interestingly enough, since then it has always voted for Democrats. What's the reason behind this sudden and dramatic change?
Mostly the Federal Government, centered in Washington DC. Fairfax County, (which sits across the Potomac from DC) for instance overwhelmingly went Democrat in 2020
This one county represents about 20% of the entire state's population. This is Farfax county's trend (Presidential contests, pulled from here)
It's helped Virginia turn bluer, but it's far from a lock. VA has had two Republican governors in that time as well (2009 and 2021).