As Paul says, even though we as human beings know God, we refuse to acknowledge him. That's what Peter did. He refused even to "know" Jesus! Peter's failure reflects all our failure. It forces us to face the reality about ourselves. But the point of the story is that Jesus foretold this - he knew it was coming. And Jesus forgave Peter, when Peter confessed his love for Jesus. So the story illustrates both the horrible nature of sin, and the amazing reality of grace. That's essential to the whole meaning of the gospel.