What does John 21:20-22 mean?

20 Then Peter, turning about, seeth the disciple whom Jesus loved following; which also leaned on his breast at supper, and said, Lord, which is he that betrayeth thee? 21 Peter seeing him saith to Jesus, Lord, and what shall this man do? 22 Jesus saith unto him, If I will that he tarry till I come, what is that to thee? follow thou me. (John 21:20-22 KJV)

William Burkitt’s Commentary

Our Saviour having foretold the manner of Peter’s death in the foregoing verses; here in these, Peter is inquisitive after, and very solicitous for the knowledge of, what kind of death St. John should die. Christ checks him for his curiosity, as meddling with that which did not concern him, yet intimates to him that John should live till he came to take vengeance on the Jews, and destroy Jerusalem: If I will that he tarry till I come; that is, till I come to execute judgment upon Jerusalem.

Here we may note, there are two great vanities in men with reference to knowledge; the one a neglect to know what is our duty to know; the other a curiosity to know what doth not belong to us to know. Christ tells Peter, it was none of his business to enquire what John should do; but he ought rather to be preparing for what he himself should suffer: If I will that he tarry, what is that to thee.