Here are some way to counter elephants for each civ. Assume equal upgrade levels both economically and militarily and Thoth-upgraded elephants.
Greek - Prodromos, Medusa. Possibly lots of Hopilites?
Egypt - Horus spearmen or Osiris camels, Mummies.
Norse - Bragi ulfsarks, Heimdall towers, Ragnarok, Frost Giants
Atlantean - Katapeltes, Fanatics, Argus.
Chinese - Wukong and Zhong Kui Halberdiers, mounted archers
Any civ can counter them in a particular area of the map by building Crenelation towers and walls. But the elephant player can just go around if they are intelligent enough to realize they can't bust through.
Also, you cannot garrison elephants in buildings once they are out on the map, only in a Roc or transport ship.