Born in Crawfordsville, Mississippi, he graduated from Southwestern Presbyterian University in 1883, and was a special student at the University of Virginia. Gregory entered the University of Texas at Austin in 1884 and graduated a year later with a degree in law.
He began the practice of law in Austin, Texas, in 1885. He served as a regent of the University of Texas for eight years. Gregory Gymnasium was named in honor of his efforts to provide an adequate exercise facility for the students and faculty of the University. He declined appointment as assistant attorney general of Texas in 1892, and an appointment to the state bench in 1896.
While embracing the progressive rhetoric of the early twentieth century with his condemnations of "plutocratic power," "predatory wealth," and "the greed of the party spoilsmen," Gregory participated in Col. Edward M. House' essentially conservative Democratic coalition.
Gregory was a delegate to the Democratic National Convention at St. Louis and State delegate at large to the Baltimore convention. He was appointed Special Assistant to the U.S. Attorney General in 1913, in the investigation and proceedings against the New York, New Haven and Hartford Railroad Company.
In 1914, President Woodrow Wilson appointed him Attorney General of the United States, and he held that office until 1919. Despite a continuing commitment to progressive reform, Gregory's performance as attorney general provoked enormous controversy because of his collaboration with postmaster general Albert S. Burleson and others in orchestrating a campaign to crush domestic dissent during World War I. Gregory helped frame the Espionage and Sedition Acts, which compromised the constitutional guarantees of freedom of speech and press, and lobbied for their passage. He encouraged extralegal surveillance by the American Protective League and directed the federal prosecutions of more than 2,000 opponents of the war.
In 1916 President Wilson wanted to appoint Gregory to the United States Supreme Court, but the attorney general declined the offer because of his impaired hearing, his eagerness to participate in Wilson's reelection campaign, and his belief that he lacked the necessary temperament to be a judge. Gregory was a member of Wilson's Second Industrial Conference in 1919 and 1920.
During a trip to New York to confer with Franklin Delano Roosevelt, Gregory contracted pneumonia and died, on February 26, 1933. He is buried in Austin.
His portrait was painted in 1917 by the Swiss-born American artist Adolfo Müller-Ury (1862-1947), and hangs in the Department of Justice in Washington DC.