St. John the Baptist died on August 29. Not in Jerusalem, but in what is now the Kingdom of Jordan, on the east side of the Dead Sea. (In New-Testament times, they called the region Perea.)
Herod the Great had rebuilt the fortress of Machaerus, after the Romans under Pompey had destroyed it in 57 BC.
Herod the Great died decades before John’s martyrdom. The Herod who ordered the execution was his son Herod Antipas, who received Galilee and Perea as his inheritance. (A different Herod, Jr.—Herod Archelaus—ruled Judea and Samaria, until the Romans re-organized it as a prefecture, governed for a time by Pontius Pilate.)
Anyway: St. John died outside Jerusalem, because he was not the Christ. He was the greatest of all the prophets, the greatest man born of woman, who served as the friend of the incarnate Bridegroom. St. John prepared the bride to meet her Husband.
He prepared the faithful remnant of Israel. That preparation involved his public condemnation of the marital infidelities of Herod Antipas and Herodias, both of whom had other living, royal spouses.
As the Lord Jesus put it: the coming of the Messiah meant the restoration of the law of lifetime marital fidelity. By His own offering of Himself on the cross for His bride, Christ consecrated the marriage bond as a sacrament of God’s fidelity to His people.
St. John died for bearing witness to this nuptial mystery of the coming of the Messiah.