Spiritually called Sodom and Egypt
Here’s what it means
The great city is morally compared with Sodom and oppressively compared with Egypt.
Why the Bible says it this way
The writer uses a picture to explain one thing by describing it as another.
A helpful detail: The text explicitly says the names are spiritual/figurative and also says the Lord was crucified there, anchoring the description in a real city.