Jesus did not say that this disciple would not die. He was speaking about John to Peter. Jesus said to Peter, not that John would remain alive until his return but rather he said, "If I want him to remain alive until I return, that is none of your concern. You must follow me and not worry about what might or might not happen to someone else." Of course that is a paraphrase of what was said. Here are Jesus words as recorded in the gospel of John [NKJV].
John 21:20-24 Then Peter, turning around, saw the disciple whom Jesus loved following, who also had leaned on His breast at the supper, and said, "Lord, who is the one who betrays You?" 21 Peter, seeing him, said to Jesus, "But Lord, what about this man?" 22 Jesus said to him, "If I will that he remain till I come, what is that to you? You follow Me." 23 Then this saying went out among the brethren that this disciple would not die. Yet Jesus did not say to him that he would not die, but, "If I will that he remain till I come, what is that to you?" 24 This is the disciple who testifies of these things, and wrote these things; and we know that his testimony is true.
I hope you have found this helpful.