The main official reason was his violation of a tenure in office law which he was charged with breaking when he fired his Secretary of War, Edward Stanton. There were a lot of people in Congress that wanted him out of office and were looking for some reason to get him out. He was unpopular because, like Lincoln , he did not want to punish the defeated southern states, but rather to take them back into the union as seamlessly as possible. He was a converted Democrat and from a slave state, Tennessee, and so had no natural power base to work in his favor.
President Johnson was primarily impeached for 1) violating the 1867 Tenure of Office Act. Other charges included 2) violating the Command of the Army Act and 3) libeling Congress with "inflammatory and scandalous harangues."
The Tenure of Office Act prohibited the President from firing any official who had been placed in office with the "advice and consent" of the Senate unless the Senate also approved the removal.
President Johnson wanted to replace Secretary of War, Edwin M. Stanton, whom Lincoln had appointed Secretary of War in 1862. Stanton had informed the President that the military chain of command had been changed, and that the Southern military leaders would henceforth answer only to Congress, and not the President.
In August 1867, Johnson responded by attempting to fire Stanton and replace him with Ulysses S. Grant, but the Senate supported Stanton and refused to confirm Grant's appointment and reinstated Stanton against the President's wishes. In February 1868, Johnson appointed Lorenzo Thomas as the new Secretary of War and ordered the Southern military leaders to report directly to him.
Stanton refused to step down, instead barricading himself in his office where he lived for three days until the House of Representatives brought eleven Articles of impeachment against Andrew Johnson for "high crimes and misdemeanors," among them violating the Tenure of Office Act in defiance of the Senate.
Johnson was impeached by a vote of 126-47 on February 24, 1868, but was acquitted by a single vote (35-19) at the conclusion of his Senate removal trial on May 16, 1868. Johnson completed his Presidential term and left office March 4, 1869. He was succeeded by Ulysses S. Grant.
For more information, see Related Questions, below.
The U.S. House of Representatives votes 11 articles of impeachment against President Andrew Johnson, nine of which cite Johnson's removal of Secretary of War Edwin M. Stanton, a violation of the Tenure of Office Act. The House vote made President Johnson the first president to be impeached in U.S. history.