If Jesus is God, then why did he ask God for the forgiveness of his persecutors in Luke 23:34?

It is important to note first that Jesus is not the only person of the Trinity. There are two additional persons; the Father and the Holy Spirit. As humans, the way that we communicate with God is through prayer. So Jesus, the Son, having a human body of flesh and bones, also needed to pray in order to communicate with God. We do not believe that he prayed to himself obviously, but when we read the verse in Luke 24, Jesus speaks to the Father and asks Him to forgive his persecutors.

It is often then asked, “well couldn’t Jesus forgive them himself if he is God?” No, because there are roles of each person in the Godhead. This is clearly laid out in scripture:

The Father’s role is adopting us into his family and forgiving our sins

“Blessed be the God and Father of our Lord Jesus Christ, who has blessed us in Christ with every spiritual blessing in the heavenly places, even as he chose us in him before the foundation of the world, that we should be holy and blameless before him. In love he predestined us for adoption as sons through Jesus Christ, according to the purpose of his will...” (Eph. 1:3-5)

“...giving thanks to the Father, who has qualified you to share in the inheritance of the saints in light. He has delivered us from the domain of darkness and transferred us to the kingdom of his beloved Son, in whom we have redemption, the forgiveness of sins.” (Col. 1:12-14)

The Son’s role is to do the will of the Father

“For I have come down from heaven, not to do my own will but the will of him who sent me... For this is the will of my Father, that everyone who looks on the Son and believes in him should have eternal life, and I will raise him up on the last day.” (John 6:38, 40)

The Holy Spirit’s role is to minister to Christians while here on the Earth. He does this in a number of ways such as making us Christians (spiritual baptism into Christ's body), sealing, indwelling,  changing our character and giving us spiritual gifts.

“But the Helper, the Holy Spirit, whom the Father will send in my name, he will teach you all things and bring to your remembrance all that I have said to you.” (John 14:26)

Being therefore exalted at the right hand of God, and having received from the Father the promise of the Holy Spirit, he has poured out this that you yourselves are seeing and hearing. (Acts 2:33)

Seeing as it is the Father who is responsible for the forgiveness of our sins, there is no problem with Jesus talking to him during the crucifixion and asking him to forgive the accusers for their sins. Further, this goes to show the mercy of Christ even amongst his murderers.