A City, after the Great Rebirth; somewhere and sometime in the post-apocalyptic future
Anthem is set in a dystopian society: a society that's the opposite of a utopia (an ideal society). More specifically, it's set in and around a City (everything in this world starts with a capital letter), a community in which every aspect of every individual's life is controlled by the government for the sake of "the great WE." The City seems to be a self-sustaining unit, with its own ruling Councils, its own agriculture, and all of the professions needed to sustain it on its own.
We have no specific information on where the City is located geographically. But we do know it's also part of a larger society ruled by a World Council, which supposedly controls many Cities exactly like it. Whether the society is worldwide is doubtful. They don't know the world well enough to even know what shape it is, and it's hard to imagine them having good enough technology to keep a large, sprawling society coordinated. We also know that there are large swaths of Uncharted Forest in between the Cities, which no one dares enter because they are untamed. There could very well be much more Uncharted Forest than there is settled land.
This society of the Great WE has apparently existed since the time of the Great Rebirth. That was the moment that came after a great war between the many and the few (also called the Evil Ones), which the many evidently won. After that, the remnants of the Evil Ones (especially their books) were destroyed, science reverted to the dark ages, and the society of the Great WE was created. What the world was like before the Great Rebirth has been suppressed and forgotten; that age is now known as the Unmentionable Times.
There are supposedly still remnants of the old civilization from the Unmentionable Times in the Uncharted Forests. Equality 7-2521 and Liberty 5-3000 find such a house there. The City in which the story is set also appears to have been built on an older city, since right outside of it Equality 7-2521 finds an underground tunnel, which sounds an awful lot like a subway. (This is, in fact, what Rand intended it to be – source). Perhaps much of the society of the Great WE is actually built on the ruins of the past civilization.
The dark world of Anthem is non-specific enough, primitive enough, and distant seeming enough to seem like some mythical fantasy land. It has the air of something timeless and "primordial." Almost like a creation myth, the story feels like something ages ago in an epic time before the current world" began. Rand's writing style in particular is responsible for creating that atmosphere, and the atmosphere is a large part of what gives the book its power.
Nonetheless, fantastic though it may seem, the world of Anthem is also supposed to be our own world, some time far in the future. The technology from the past that Equality 7-2521 and Liberty 5-3000 discover is our technology, and the new names Equality 7-2521 and Liberty 5-3000 give themselves come from our Greek myths. But if this is our future, it's definitely a post-apocalyptic one, since civilization as we know it has ended by the time the story begins.
By setting Anthem in such a future, Rand forces us to consider the possibility that the nightmarish world she portrays might yet become a reality.