Because he is also true Man, with human emotions. Because he is true God, he could never be separated or abandoned by God. Because he is sinless, he never broke communion with God. But because he bore the sins of the whole world on the cross, becoming sin for us, as it were, it was only natural that in his human nature, he could have the emotion of feeling abandoned by God. But by quoting the first words, of all things, Psalm 22, the cry from the cross was not one of expressing that feeling of abandonment. It was also an application of the Psalm’s triumphant ending to himself, which is exactly what happened three days later.