The gospels record that just after his baptism by John, Jesus is tested in the desert. In Matthew's gospel, the tester is referred to as "the devil" in the first two tests but Matthew ends the third test with Jesus naming the tester as "Satan." It is helpful to see what this test was about and how the word "Satan" appears in a later incident in Matthew.
In the third test, Jesus is promised "all the kingdoms of the world" if he would turn from God and instead worship the devil. Jesus replies, sharply, "Be gone Satan for it is written that you shall worship the LORD your God and only serve him!"
Fast forward to the journey of Jesus and the disciples to Jerusalem. During the trip, Matthew recounts that Jesus three times predicted his passion, death and resurrection. Each prediction is followed by a misunderstanding on the part of the disciples, all, in fact, related to Jesus establishing a worldly kingdom. In the second misunderstanding the disciples are vying to "be greatest" and in the third James and John want to have the seats of honor and power next to Jesus in his kingdom (17:22-27; 20:17-28).
The first prediction —misunderstanding is related to the third temptation of Jesus in the desert. Jesus predicts his coming suffering and Peter takes Jesus aside and rebukes him saying "God forbid it, Lord! This shall never happen to you." Peter's rebuke could be interpreted that he did not wish to see Jesus suffer and die. The story of John the Baptist's execution had already been told in Matt. 14:1-12, so Peter was aware of the risks to Jesus.
Jesus replied, "Get behind me Satan! You are a stumbling block to me for you are not setting your mind on divine things but on human things" (16:21-23). Peter is the only human person called "Satan" in the gospels, and using Satan's name indicates that Peter expected Jesus to establish an earthly kingdom. Jesus has rejected this notion as turning away from his mission from God when he sent Satan on his way in the desert. Now Jesus tells Peter that avoiding suffering and death is equivalent to Jesus turning away from his mission and from God.
There is more. Immediately after rebuking Peter, Jesus tells his disciples, "If any want to become my followers, let them deny themselves, take up their cross and follow Me. For those who want to save their life will lose it and those who lose their life for My sake will find it" (16:24-25). Following Jesus involves accepting to suffer. Clearly, Peter would have known that if Jesus were to be crucified, Peter himself was in danger of the same fate.
Moreover, given the desert test from Satan, seeking an earthly kingdom (and its honors and power) is equivalent to turning from God and worshipping Satan. Just before the passion prediction, Jesus had proclaimed that Peter was the rock upon which the Church would be built (Matt. 16:18). What would happen to Peter's place if Jesus were executed? No wonder Jesus rebuked Peter; the Church was not to be an earthly kingdom lest its leader(s) would be tempted to turn from God to evil.
Reflecting on this one sees a rebuke of disciples who stray from a commitment to God by seeking earthly kingdoms/queendoms. Moreover, as Donald Senior notes: "'to take up the cross' implies an intentional and active commitment to follow Christ, including embracing the possibility of rejection and suffering and even death itself for the sake of the gospel" (Why the Cross? p. xv).