Washington, D.C. is not in Virginia. It is, in fact, located in the District of Columbia, a 61-square-mile zone independent of any state. It was created when Virginia and Maryland donated land for the new federal government.
The District of Columbia was designated by the United States Constitution to be the nation's capital. Its location along the Potomac and Anacostia rivers was a compromise to slave-holding Southern states and free Northern states. It was a centrally located spot, both geographically and politically. Though Washington was established as the future home for the government in 1790, the city was not ready for the government to move in until 1800.