When she wrote Anthem, Ayn Rand hadn't yet fully developed the distinctive philosophy of Objectivism for which she later became known. Many of the essentials, however, are already at play in the novella, especially the central idea of egoism, the belief that every individual should freely pursue his or her own personal happiness without any sense of being obligated to other human beings. Rand sees the human individual as the highest, most sacred being in the universe. All of these ideas and more are brought out in the last pages of Anthem (a literal anthem to the human ego), which read like an egoist manifesto.
Equality 7-2521 only thinks himself to be an egoist. His actions show him not to be.
Egoism and collectivism are not necessarily opposed.