Gorham was born in Charlestown, Massachusetts, and was the son of Captain Nathaniel Gorham and his father's wife Mary Soley. He was a descendant of John Howland, (c. 1599 – 1673) who was one of the Pilgrims who traveled from England to North America on the Mayflower, signed the Mayflower Compact, and helped found the Plymouth Colony.
He took part in public affairs at the beginning of the American Revolution, he was a member of the Massachusetts General Court (Legislature) from 1771 until 1775, a delegate to the Provincial congress from 1774 until 1775, and a member of the Board of War from 1778 until its dissolution in 1781. In 1779 he served in the State constitutional convention. He was a delegate to the Continental Congress from 1782 until 1783, and also from 1785 until 1787, serving as its president for five months from June 6 to November 5, 1786 after the resignation of John Hancock. Gorham also served a term as judge of the Middlesex County, Massachusetts Court of Common Pleas.