The story of the game is that a horrible disease is slowly wiping out humanity. In an effort to stop it, scientists managed to create living dolls with no soul or consciousness, initially. The plan was to transfer people's souls into these artificial bodies, allowing them to keep living and avoid horrible death through the illness.
However, the dolls somehow obtained their own consciousness.
Fast-forward a few hundred years. Nier, the main character, is a Shade-hunter and odd-job man. Shades are strange monsters that attack travelers and villagers. Nier's daughter is ill, and he is trying to find a way to cure her. Unfortunately, she is kidnapped by The Shadowlord, which begins a quest to rescue her.
Anyway, in one of the near-end boss battles, Nier learns that not everything is as it seems. He, and everyone else he knows, are not people. They are the dolls from many years past. Replicants. He also learns that the Shades are the physical manifestations of the people who succumbed to the illness because the Replicants gained their own consciousness. The reason The Shadowlord kidnapped Nier's daughter is that The Shadowlord is also one of the wandering souls of the people. Nier's daughter is the same age as The Shadowlord's daughter, and he kidnapped her in order to give his own daughter a body.
Finally, we learn that The Shadowlord is in fact the true Nier. Nier is the Replicant that was meant to house The Shadowlord's soul.