Hamilton was born in Huntsville, Alabama on January 28, 1815. His education began in Alabama where he went to law school and was eventually admitted to the bar in Talladega, Alabama. In order to join his older brother Morgan, Hamilton moved to Texas late in 1846 and opened his own law practice in La Grange, Texas. Three years later he left the city, moving to Austin, Texas to begin his political career.
In 1849 Hamilton was appointed as the acting state attorney general by Texas Governor Peter H. Bell.
In 1850 he was elected to the Texas House of Representatives representing Travis County as a Democrat. He would only serve one term, leaving office in 1853. During this time he joined the "Opposition Clique", a faction of southern politicians in the Democratic Party who opposed secession and the reopening of the slave trade.
In 1858, Hamilton was elected to the United States House of Representatives as an Independent Democrat representing the western district of Texas. During this time he served on a House committee formed late in 1860 to solve the growing sectional feud between the North and South. He chose not to run for re-election in 1860, but, on his return to Texas in 1861, won a special election to the State Senate. Hamilton was later forced to resign this post after threats to his life for his pro-Union statements. He fled to Mexico in July 1862.
During the American Civil War, Hamilton sided with the Union. After fleeing to Mexico, he went on a tour of the Northeast, giving speeches in New York, Boston, and other northern cities. He spoke out in favor of the Union and criticized the "slave power" of the South. Because of this Hamilton was regarded as a hero by the North, though he was generally viewed as a traitor at home.
In late 1862 President Abraham Lincoln named Hamilton the Military Governor of Texas with the rank of brigadier general of volunteers. He spent the rest of the war holding this empty position in New Orleans, after a Union attempt to capture South Texas failed in 1863.
On June 17, 1865, President Andrew Johnson named Hamilton as the provisional civilian governor of the state. Hamilton held office for 14 months during the early stages of Reconstruction. He was governor when the nation ratified the Thirteenth Amendment and granted economic freedom to the newly freed slaves, although Texas itself declined to ratify the amendment until 1870. Hamilton also faced problems such as Indian incursions, general lawlessness, and chaotic finances in the aftermath of the Civil War. When his plans at the Constitutional Convention of 1866 were not enacted, he rejected Johnson's plan for Reconstruction and aligned himself with the Radical Republicans. He spoke out in favor of black suffrage and in September 1866 organized the Southern Loyalists' Convention in Philadelphia, where he criticized President Johnson. He resigned in 1867 and went to work as a bankruptcy judge in New Orleans. Later that year he accepted a position as a justice on the Texas Supreme Court. Hamilton tried to regain the governorship in the election of 1869, but was defeated by Edmund J. Davis.
After leaving office, Hamilton switched to the regular Republican Party. He served on the Texas Constitutional Convention of 1868–69 and on the Republican National Executive Committee. He reversed his views on black suffrage, withdrawing his support for it. After losing the Gubernatorial election in 1869, Hamilton served as the leader of Tax-Payers' Convention in 1871.
Andrew Jackson Hamilton died in Austin, Texas on April 11, 1875 of tuberculosis. He is buried at Oakwood Cemetery.