William Grayson was born in Prince William County and was the son of a merchant. Well-educated at what became the University of Pennsylvania and in Great Britain, he began to practice law in the Prince William County town of Dumfries during the winter of 1765–1766, where he took part in protesting the Stamp Act. Ten years later, as colonel of the Prince William battalion of minutemen, he marched his men to Hampton to keep watch on the British. In the spring of 1776 Grayson joined the staff of General George Washington. He spent the winter of 1777–1778 with the army at Valley Forge, and he commanded a regiment in the Continental army until 1779, when his regiment was merged with another. Grayson was a member of the Continental Board of War in 1780 and 1781 before returning to Virginia to practice law.
Grayson was elected to the House of Delegates in 1784 and in 1788 and represented Virginia in Congress from 1785 to 1787. Although he supported strengthening the national government, he disapproved of many provisions of the Constitution that the Convention of 1787 recommended to the states for ratification. He was elected to the Virginia ratification convention that met in Richmond in June 1788. Grayson was an excellent speaker and one of the best debaters in the convention. With Patrick Henry and George Mason, he was one of the principal leaders of the opponents of ratification, and he spoke often and persuasively, and on some occasions humorously, on the floor of the convention. Grayson shared with Henry and Mason and the other critics of the Constitution a fear that it would allow northern and northeastern states to form majorities in Congress against the interests of southern states and also jeopardize essential interests of westerners. Many inhabitants of the Virginia District of Kentucky worried that a treaty resembling one that John Jay, of New York, had negotiated with Spain might pass the Senate and deprive them their ability to reach the world's markets through the port of New Orleans. Grayson voted against ratification of the Constitution and voted for a long list of amendments that the convention recommended be added to the Constitution. Those amendments included the provisions that became the Bill of Rights as well as important structural modifications to the separation of powers and checks and balances.
In 1789 the General Assembly elected Grayson and Richard Henry Lee the first United States senators from Virginia. They tried and failed to include the structural modifications in the list of constitutional amendments that Congress submitted to the states later in the year. They also failed to persuade their fellow senators to conduct Senate business in public session. William Grayson died at his home in Dumfries on March 12, 1790, after serving for only one year in the United States Senate. His will freed all of his slaves who had been born after 1776.