Article: Man (or cute girl) in the iron mask
Man (or cute girl) in the iron mask
The use of robots in anime goes as far back the first anime series Tetsuwan atom (Astro boy) and is still widely used today. Although in most cases their has been a big change as Atom was a robot with a personality where as most of the mecha today are nothing more than giant suits of armor the basic premise remains the same. Forgive me for a slight digression but once I have heard that Kabuki theater is best at portraying women because any real woman is only the type of woman that she really is but a man can be any woman. I know it sounds odd but this statement maybe more readily true about robots portraying better humans than real humans, with excellent examples of this idea both in anime and in live action television (AI and Data from star trek generation come to mind).
First and foremost a robot in anime is generally a mechanical human. This is two different concepts combined into one. Only by exploring each concept separately I believe that you can understand how robots are thought of in anime.
By nature robots are mechanical. Also for the most part (Bubble gum crisis aside) robots are usually seen as useful and beneficial to mankind. Like almost anything in any art form there is a reason for this. Japan is very dependent on technology for it's place and the world and the Japanese believe they have no choice when it comes to abandoning it. Given that idea it makes since that they don't have many stories about killer robots since instead of technology being scary to the Japanese it is something that empowers them (see fifty foot mask).
A robot (often referred to as an android as actually the term robot covers a lot of things) in anime is most often depicted as something very human. I believe there are two reasons for this, one universal and one that may be particularly Japanese.
A robot is often used in questioning what is humanity. This is because a robot is something that with the progression of science can more and more approach the thinking capacities of a human being. Also as robots are something that advance with technology and programming it allows the author to give a sliding scale as how human a robot can be (Chobits is an excellent example of this, just watch Chi's progression through the episodes).
I believe that there may be an additional reason that robots are so common in anime and are most often portrayed sympathetically in anime. It could be that a robot is something that willingly fulfills the needs of others without thinking of it's own desires exemplifies expected Japanese behavior. Given that the being, metallic as it is, is acting so well treating it poorly would simply be impolite, which is very un-Japanese. So the robot ends up becoming a part of the family.