Essentially Alexei was sentenced to death because he was accused of treason - a State crime punishable by death.
Upon Alexei's return from Naples he 'admitted' to his crimes while experiencing several days of horrendous torture. A rapidly convened Tribunal composed of Senators, Ministers, the military and clergy was set up, who all signed a document which they presented to Peter expressing a unanimous verdict of guilty. The only safe verdict which was expected to be handed down. The Tribunal deemed that the Czarevich deserved the death penalty because of his Capital crime against the State, against his Sovereign, who just happened to be his father.
In his hand-written confession Alexei wanted to see his father dead, so that all the Petrine reforms could be suppressed. He envisaged driving out all foreigners from Russia, which meant that the German language and all sciences could also be suppressed. He also wanted Menshikov punished.
Catherine asked Peter to have the sentence commuted, so that Alexei could become a monk.
However it maybe presummed that Peter was not only ashamed of his treacherous son (a potential heir), but he firmly believed it was his duty to the Russian Empire that he alone must prevent his son from ever having the opportunity to repeat his actions again. Peter loathed weakness and traitors and therefore it was for the Emperor to show his subjects that no-one was permitted to stand in the way of reform. His own son was not immune.
A nocturnal visit by Peter to the Trubetskoi Bastion at the Fortress after the death sentence was pronounced apparently triggered a series of convulsions by Alexei. Although there are suggestions that these convulsions never occurred, and that Alexei was actually be-headed. The same fate which was met by Alexei's fellow conspirators.
Whether Peter actually had a direct hand in his son's demise has also been questioned, because there has been no real proof that any such an action had actually occurred. Where ever the real truth lies, Peter in the end felt vindicated.
Peter accompanied by Ekaterina, attended his son's funeral and was seen to weep and kiss his son's lips in the open coffin. He never regretted his decision not to commute the sentence.
Peter's reforms to modernize Russia certainly travelled a harsh path. Perhaps Catherine finally concurred with Peter about Alexei's fate at the time, I do not know if she felt otherwise. If Peter was actually innocent of killing his own son, then no doubt Ekaterina would have understood that the course of events which ensued were inevitable.