What did Jesus mean when He said somewhere that He came to bring a sword to the earth? This seems to be the opposite of what He said elsewhere, about bringing us peace if we'll follow Him.
You’re probably thinking of what Jesus said on one occasion, when He was sending His disciples out on a special mission of healing and teaching: “Do not suppose that I have come to bring peace to the earth. I did not come to bring peace, but a sword” (Matthew 10:34).
What did Jesus mean by this? He was warning them that their task would not be easy, because they would encounter very strong opposition from those who did not believe in Him. In fact, He told them, some people would hate them because of their loyalty to Christ, and they might even be arrested and condemned to death. A world that loved its sins more than it loved God would not welcome them, and they should be prepared for it.
You are right: Jesus Christ promises us peace when we come to Him and open our hearts to Him – peace with God, peace with others, and peace in our hearts. His promise is true: “Peace I leave with you; my peace I give you” (John 14:27). Have you discovered this truth personally? You can, by turning to Him and asking Him to come into your life as your Saviour and Lord.
But what if we don’t welcome Him? What if we don’t want anything to do with Him? Then conflict is inevitable – conflict with God, conflict with others, and conflict within ourselves. And when that happens, Jesus brings not peace but a sword – the sword of His judgment. Don’t let this happen to you.