It’s a city. But unlike other cities, it is also a federal district that was created for the sole reason of becoming the nation’s capital.
Washington, D.C.’s unique status goes back to the country’s early days. America’s Founders worried that if the national capital were located within a state, that state might have too much power over the federal (national) government. So they wrote in the Constitution that the nation’s capital should be located in a federal district that isn’t part of any state.
The federal government moved to the District of Columbia in 1800.