Grayson was born in 1740 to Benjamin and Susannah (Monroe) Grayson at Belle Aire Plantation, in what is now Woodbridge, Virginia. He received his degree in Law from the University of Oxford and was knowledgeable in Latin, Greek, and English history
Grayson practiced law, principally in Prince William County, Virginia. The county seat was at Dumfries, Virginia, not far from Grayson's home as well as Belle Aire Plantation, which his brother Spence Monroe Grayson (1737–1798) inherited in 1757. On the other side of the Occoquan River lay Fairfax County, Virginia, and Grayson was also familiar with leaders of that county, especially George Mason and George Washington. Spence Grayson was ordained an Anglican priest in England in 1771, and served as rector of Cameron and Dettingen parishes in Prince William County and both brothers socialized with Rev. Scott of Pohick Church as well as Mason and Washington who were members of that church's vestry.
When the American Revolutionary War began, Grayson volunteered, and became an aide-de-camp to George Washington, Grayson rose to the rank of lieutenant colonel. In 1777, William Grayson recruited a regiment for the Continental Army known as Grayson's Regiment, and served as its colonel (and Spence as its fighting chaplain) through the Philadelphia campaign. In 1778, William Grayson served on a commission dealing with war prisoners, and in 1779 he resigned his military commission to serve on the Congressional Board of War. In 1781 he returned to Dumfries to practice law. Like many Continental Army officers, he was an original member of the Society of the Cincinnati.
Grayson was a delegate to the Confederation Congress from 1785 to 1787. He helped to pass the Northwest Ordinance, including a provision that forbad slavery in the Northwest Territory.
As an Anti-Federalist, he joined George Mason, James Monroe, and Patrick Henry in opposing ratification of the proposed new United States Constitution at the Virginia Ratification Convention in 1788. In that Convention, Grayson argued that the proposed constitution was neither fish nor fowl—neither strong enough for a national government nor decentralized enough for a federal one — and thus eventually would either degenerate into a despotism or result in the dissolution of the Union. Although the Anti-Federalists lost that battle, Patrick Henry, Virginia's leading Anti-Federalist, rewarded Grayson by arranging his election to the first United States Senate. Grayson served from March 4, 1789 until his death on March 12, 1790. He and Richard Henry Lee were the only members of the first Senate who had opposed ratification, and so they were unhappy (but not surprised) when the Bill of Rights omitted any provisions making serious corrections to the division of powers between the central government and the states. Grayson continued to believe that the Philadelphia Convention had struck precisely the wrong balance.
Grayson experienced the inflation caused by Virginia and other states issuing paper fiat currency during the Revolutionary War. He later wrote to James Madison that:
Through his mother Grayson was a cousin to James Monroe. His wife was Eleanor Smallwood, a sister of Maryland Governor William Smallwood. They had four sons and a daughter. A grandson, William Grayson Carter, became a Kentucky state senator; another grandson was Confederate General John Breckinridge Grayson.
Spence Grayson's son John Robinson Grayson (born in 1779 at Belle Aire), was captured near the Occoquan River from the brig Polly, operated by Lund Washington. Impressed into the British Navy, upon his release in 1800, John Grayson became a captain in the United States Navy. In the War of 1812, Capt. Grayson commanded a squadron of gunboats off Georgia, where he settled.
Grayson died in Dumfries on March 12, 1790, the first member of the United States Congress to die in office. He is interred in the Grayson family vault at Belle Aire. The original mortuary vault was destroyed during the American Civil War. It was rebuilt, encased in concrete and buried by the Daughters of the American Revolution in the early 20th century.
Grayson County, Kentucky, the city of Grayson, Kentucky, and Grayson County, Virginia, were all named for the senator.