One reason was pragmatism. Grant did not want to take prisoners, and did not think the Union was in any danger from Confederates who had surrendered.
Also, both Grant and Lee felt that this was a historic moment, and it brought out the noble side in both of them. It was a moment for gracious and magnanimous gestures.
Chat with our AI personalities
Most likely, Grant was apalled by the Horror of the Civil War, and he wanted it concluded as quickly as possible. There were certainly other Union generals who hated the South so much that they would have tried to impose stricter terms, but my understanding of Grant is that he simply wanted an end to the war, and he offered generous terms that Lee would readily accept. I think it is also possible that Grant never lost sight of the tragedy that this war was a civil war with Americans fighting Americans, while other Union generals despised the Confederacy even more than they would have hated a foreign enemy. I think that Grant sometimes had to strike a fine balance between his humanitarianism and his military pragmatism, but the generous terms he offered to Lee were one instance when these two qualities were in concert.
The men of the Army of Northern Virginia were only required to hand over their weapons and go home peacefully. There would be no prisoners taken, no charges of treason, and no persecution afterwards.
This was a remarkably favourable deal, and Lee responded to it by forbidding any idea of taking to the hills and carrying on guerrilla warfare, as some of his officers were urging.
At Appomattox, both men felt the solemnity of the moment, and it brought out the noble side in both of them.
The soldiers surrender to be paroled and won't take arms up again and all arms, and ammunition. The civility led to reconciliation.
Ulysses S. Grant
Ulysses S. Grant wrote the terms of surrender.
The terms were remarkably generous. He just told Lee's army to hand in their weapons, sign the parole, and go home - and if they did that, they would not be persecuted, and Lee would not be arrested. It silenced those Confederate officers who were urging the men to take to the hills and conduct guerrila operations.
U.S. Grant