Rand, as a teenager living in Soviet Russia, initially conceived Anthem as a play. After migrating to the United States, Rand didn't think of writing Anthem, but reconsidered after reading a short story in The Saturday Evening Post set in the future. (The story in question was probably "By the Waters of Babylon" by Stephen Vincent Benét, which was published as "The Place of the Gods" in the July 31, 1937 edition.) Seeing that mainstream magazines would publish a "fantastic" story, she decided to try submitting Anthem to them. She wrote the story in the summer of 1937, while taking a break from research she was doing for her next novel, The Fountainhead.
Rand's working title was Ego. Leonard Peikoff explains the meaning behind this title: "[Rand] is (implicitly) upholding the central principles of her philosophy and of her heroes: reason, values, volition, individualism." Thinking that the original title was too blunt, unemotional, and would give away too much of the theme, Rand changed the title to Anthem. "The present novel, in Miss Rand's mind, was from the outset an ode to man's ego. It was not difficult, therefore, to change the working title: to move from 'ego' to 'ode' or 'anthem', leaving the object celebrated by the ode to be discovered by the reader."
There are similarities between Anthem and the 1921 novel, We by Yevgeny Zamyatin, another author who had lived in communist Russia. These include:
- A novel taking the form of a secret diary or journal.
- People having numbers instead of names.
- Children separated from their parents and brought up by the State
- Individualism disposed of in favor of collective will.
- A male who discovers individuality through his relationship with a female character.
- A forest as a 'free' place outside the dystopian city.
- The main character is a man.
- This character discovers a link to the past, when men were free, in a tunnel under the Earth.
There are also a number of differences between the two stories. For example, the society of We is in no scientific or technological decay, featuring X-rays, airplanes, microphones, and so on. In contrast, the people of Anthem believe that the world is flat and the sun revolves around it, and that bleeding people is a decent form of medicine. The similarities have led to speculation about whether Rand's story was directly influenced by Zamyatin's. However, there is little evidence that Rand was influenced by or even read Zamyatin's work, and she never mentioned it in discussions of her life in Russia.
Initially, Rand planned on publishing Anthem as a magazine story or serial, but her agent encouraged her to publish it as a book. She submitted it simultaneously to Macmillan Publishers in America and Cassell in England. Both had handled her previous novel, We the Living. According to Leonard Peikoff, "Cassell accepted it immediately... Macmillan turned it down; their comment was: the author does not understand socialism." Another American publisher also turned it down, and Rand's agent was unable to sell it as a magazine serial. Cassell published it in England in 1938.
After the success of Rand's novel The Fountainhead, a revised edition of Anthem was published in the US in 1946 by Pamphleteers, Inc., a small libertarian-oriented publishing house owned by Rand's friends Leonard Read and William C. Mullendore. The original English edition (Cassell 1938) entered the public domain in the United States in 1966, due to the failure to renew its copyright after 28 years as then required by US copyright law. A 50th Anniversary Edition was published in 1995, including an appendix which reproduces the Cassell edition with Rand's handwritten editorial changes.