My understanding is that she formed an anti-communist view early on in her life, so she swung to the opposite extreme. She wrote screenplays and novels to express her worldview, and she elaborated on that in some philosophical articles afterward.
Apparently, Rand justified her taking of social insurance money by calling it "restitution" for what the various welfare systems took from her. So only those who oppose the welfare state are entitled to take from it, on her view, as long as they deem the benefits payback against the government. Very convenient reasoning.
Amusingly, she seems to have agreed to take social security money because of the high costs of medical care in the US, which might have bankrupted her. Hurray for capitalism in the field of medicine!