Why did Jesus question God on the cross? Jesus was sent to earth to die for our sins. He knew it when the time came but from this verse:


  "And about the ninth hour Jesus cried with a loud voice, saying, Eli,
  Eli, lama sabachthani? that is to say, My God, my God, why hast thou
  forsaken me? " (Matthew 27:46).


He seemed to be saying "Hey Dad, why are you leaving me, this wasn't part of the plan."

With such a loud cry, this must have been an emotional pain he went through aside the physicaly pain on the cross. Why did he have to ask his Father that question?
I do not think that one reading the Gospel account could say that Jesus was wondering of the plan of God at this point in the salvation history. Here is how Jesus present himself in the good shepherd discourse :


  14 I am the good shepherd. I know my own and my own know me, 15 just as the Father knows me and I know the Father; and I lay down my life for the sheep. 16 And I have other sheep that are not of this fold. I must bring them also, and they will listen to my voice. So there will be one flock, one shepherd. 17 For this reason the Father loves me, because I lay down my life that I may take it up again. 18 No one takes it from me, but I lay it down of my own accord. I have authority to lay it down, and I have authority to take it up again. This charge I have received from my Father.” 
  The Holy Bible: English Standard Version. 2001 (Jn 10:14–18). Wheaton: Standard Bible Society. 
  emphasis added


Jesus came to die on the cross. It was not part of the plan, but the plan all together. Here is how John the Baptist presents Jesus :


  29 The next day he saw Jesus coming toward him, and said, “Behold, the Lamb of God, who takes away the sin of the world! 
  The Holy Bible: English Standard Version. 2001 (Jn 1:29). Wheaton: Standard Bible Society.




The cross was the plan all along. Why did Jesus quote the psalm 22 on the cross? In doctrine there is a separation in the relationship between Jesus and God, when Jesus bored the sins on the cross. That was the first separation of Jesus with the Father since eternity past. That might be the reason why Jesus quotes this psalm.