James McHenry was born on November 16, 1753, in Ballymena, Ireland, to Daniel and Agnes McHenry. In 1771, he emigrated to Philadelphia, and was joined by his father the next year in Baltimore, where the elder McHenry started a successful importing business. Having first received his education in Dublin, James continued his studies at Newark Academy in Delaware in 1772, before beginning the study of medicine in Philadelphia under Dr. Benjamin Rush. McHenry first volunteered for military service in 1775, and he served as an assistant surgeon at the Cambridge military hospital in Massachusetts, before being appointed surgeon of the 5th Pennsylvania Battalion in August 1776. The British captured McHenry at Fort Washington in November, and he was paroled the next January, before being exchanged in March 1778. On May 15, 1778, George Washington appointed him as his secretary, a position he held until he became a member of Lafayette's staff in 1780. In 1781, Maryland elected McHenry to its State Senate, where he served until 1786. The next year, he was a delegate to the Constitutional Convention, where he created a private record of the proceedings.
After the convention, McHenry returned to Maryland and was a member of the constitutional ratifying convention for the state. He served as a member of the Maryland Assembly and then the Maryland Senate, before being offered the position of secretary of war to replace Timothy Pickering in January 1796. He served until 1800, when President John Adams forced his resignation over increasing tensions arising from McHenry's alignment with Alexander Hamilton. After his resignation, McHenry came under attack from Republicans, who accused him of misusing funds during his tenure as secretary of war. A congressional committee declined a formal investigation, but McHenry delivered a defense before Congress on December 28, 1802. Afterwards, McHenry retired to Fayetteville, his estate near Baltimore, where he founded the first Bible society in Baltimore, in 1813. McHenry died in 1816, survived by his wife Margaret Caldwell, and two children.