Did congress have a legitimate reason for impeaching Johnson?

Not really. The president is head of the executive branch of the government. The cabinet of a president is those who head the different departments of the executive branch. These department heads are called "secretaries". Secretaries are nominated for the job by the president, and confirmed by the Senate, meaning they get the job. Congress had passed a law called the Tenure of Office Act, which purported to make it a law that a president could not fire any of his department heads (secretaries) without approval of congress. So this was the legislative branch telling the executive branch that the executive branch could not manage its own affairs, and had to let the legislative branch interfere in such decisions. This would have meant that no president could demand loyalty from his cabinet secretaries - they would not have to do what the president ordered them to do, because he could not fire them unless he could get congress to sign off on it. This, as it turns out, was eventually ruled by the Supreme Court to be an unjustifiable interference by the legislative branch in the business of the executive branch. But at the time Johnson was impeached that ruling from the Supreme Court was still in the future. When Johnson fired one of his cabinet secretaries, a hold over from Lincoln's administration, this was made the basis for the charges in his impeachment.