After Virginia's special convention approved and ordinance of secession in April, 1861 to join the Confederacy, the Confederate capital was moved from Montgomery, Alabama to Richmond, Virginia. (Technically, Virginia's secession from the Union did not become official until May 24, 1861, after Virginia voters ratified the decision of the secession convention.)
Moving the capital to Richmond put the southern rival to Washington DC just 100 miles away. That's why the first large-scale invasion of the Confederacy was in northern Virginia at Alexandria, and the first major battle occurred two months later at Manassas.
After declaring secession, the Confederacy simply needed to survive in order to prove it was an independent nation. The Union, on the other hand, needed to demonstrate it still controlled all of its southern territory, and that 11 seceding states were still part of the United States rather than a separate country. Otherwise, European nations would recognize the Confederacy and provide political, economic, and military support - just as France had provided essential resources for 13 rebellious colonies in 1776-1783, to establish their independence from Great Britain.
To end the rebellion, the Union needed to ensure the Confederacy did not survive. In 1861, the easiest way to destroy the upstart government in the southern region was to capture Richmond, the new capital of the Confederacy. If the Confederacy could not defend its own capital, then clearly European nations would not recognize the Confederacy as independent... no matter how much England wanted to see the United States dissolve into less-powerful fragments.
Technically, Virginia's secession from the Union became official on May 24, 1861. Early that morning, Union troops crossed the Long Bridge and marched along the extension of the C&O Canal between Aqueduct Bridge and Alexandria. At the same time, Union forces were carried across the Potomac and landed at the Alexandria wharfs.
As the Union forces entered Alexandria, the 17th Virginia Regiment retreated westward. No fighting occurred, except when the commander of the Union forces (Elmer Ellsworth) tore down the Confederate flag flying over a hotel at King and Pitt Street. James Jackson, manager of the Marshall House, shot Ellsworth and was killed in return by a Union soldier.1
the Confederate army in the Shenandoah Valley marched across the Blue Ridge and rode the Manassas Gap Railroad eastward in mid-July, 1861; those extra forces on the battlefield were key to the Confederate victory at First Manassas
Source: National Park Service, A New Economy of War
Seizing Alexandria was a tactical move to protect Washington DC. It eliminated the risk of Confederates placing cannon on the hills of the city and shelling the Capitol or the White House. Alexandria remained in firm control of the Union throughout the Civil War - and between 1863-65, the administration of Abraham Lincoln treated Alexandria as the official capital of Virginia. (Some old Virginia families living south of the Rappahannock River talk as if Northern Virginia has been "occupied" ever since 1861...)
After seizing Alexandria in May, 1861, the Union Army was still 100 miles north of Richmond. To get there, it would have to march, carrying food/ammunition for soldiers and hay for horses pulling the supply wagons. To minimize the logistical challenge, the Union planned to rely upon the railroads that connected Alexandria and Richmond.
Today, there is a rail line running due south from Alexandria, going through Woodbridge, Quantico, then Fredericksburg to Richmond. In 1861, however, there was a gap between Alexandria and Fredericksburg. Boats carried freight and passengers down the Potomac River from Washington/Alexandria to Aquia, near Fredericksburg. The boats docked at Aquia, where passengers/freight transferred to the railroad - known appropriately as the Richmond, Fredericksburg, and Potomac (RF&P).
There was no Richmond and Alexandria Railroad, but there was a rail line leading west of Alexandria - the Orange and Alexandria, built to facilitate trade with farmers east of the Blue Ridge. The Orange and Alexandria connected with the Virginia Central at Gordonsville. A Union Army that seized control of the Orange and Alexandria and the Virginia Central railroads could carry lots of supplies in rail cars pulled by locomotives, reducing the number of horses. The route through Manassas and Gordonsville would involve a curving path to the west initially, and longer than a direct march south from Alexandria - the logistical support from railroad transport would make an attack on Richmond much easier.
So in mid-July, 1861, the Union Army marched west through Fairfax Court House to Centreville. Union forces sparred with Confederates on July 19, 1861 at the fords of the Bull Run, especially between Centreville and Manassas where Route 28 and Old Centreville Roads cross the stream from Prince William County to Fairfax County. Two days later on July 21, the Union Army faked at attack across Bull Run at the Stone Bridge of the Alexandria-Warrenton Turnpike (modern Route 29). General McDowell, commanding the Union forces, sent most soldiers on a long march in a "right hook" to cross Bull Run at Sudley Springs (where Route 234 crosses today).
The maneuver worked initially. By early afternoon of that hot July day, McDowell thought he had won a glorious victory. However, Confederates blocked further advance down the road from Sudley Springs to the railroad depot in Manassas, especially when General Thomas Jackson ordered his soldiers to "stand like a stone wall" rather than retreat. During the day, more Confederates soldiers arrived on trains, which hauled most of a separate Confederate army that had been in the Shenandoah Valley. The extra soldiers proved to be the turning point, finally forcing Union forces to retreat back to Alexandria/DC.
The result: the march on Richmond was stopped in 1861. The Union forces spent the winter in Alexandria and DC. The Confederates built fortifications in Centreville, Manassas, and along Bull Run to Occoquan. Throughout the winter, Confederate cavalry patrolled to the hills overlooking Alexandria, including Munson's Hill and Upton Hill in modern-day Arlington County.
Little fighting occurred that winter, or in other winters during the Civil War. Soldiers stayed in "winter quarters" because winter rains left roads frozen and muddy, impassable to armies hauling heavy artillery and wagons. Civil War fighting was typically between May-October, due to the transportation constraints.
After its defeat in July 1861, the Union Army recruited soldiers, gathered supplies, and trained under new leadership. General McClellan figured out a different way to move the Union army 100 miles south, and started on a separate path to Richmond in March, 1862.