The genre started with Mitsuteru Yokoyama's 1956 manga Tetsujin 28-go (which was later animated in 1963 and also released abroad as Gigantor). Its inclusion is debatable however, as the robot was controlled by remote instead of a cockpit in the machine. Not long after that the genre was largely defined by author Go Nagai, into something considerably more fantastical. Mazinger Z, his most famous creation, was not only the first successful Super Robot anime series, but also the pioneer of the genre staples like weapons that were activated by the hero calling out their names ("Rocket Punch!"). It was also a pioneer in die-cast metal toys such as the Chogokin series in Japan and the Shogun Warriors in the USA, that were (and still are) very popular with children and collectors. Getter Robo, for its part, was the first combining mecha, something that became a frequent design theme and was aggressively imitated in similar mecha shows.
The appearance of Gundam in 1979 is considered to have broken the mecha genre into two subsets: the Super Robot show, which focused on ultratech mecha that often had elements of mysticism and tend to use a "monster of the week" format; and the Real Robot show, in which the mecha are shown as tools rather than semi-mystical creations, and the focus is less on the machines and more on the pilots. The introduction of Mobile Suit Gundam in 1979 introduced a sort of paradox: a war show about giant war machines that was in fact anti-war at heart.
Other notable series include but are by no means limited to The Super Dimension Fortress Macross, which in its modified Robotech form led to the breakthrough of anime in the USA, Hideaki Anno's Gunbuster, which along with Macross and Gundam is considered the pinnacle of mecha anime in the 1980s, the police-focused Patlabor, and as examples of older shows, Go Lion (Voltron) and Giant Robo as well as Full Metal Panic. Macross was especially noteworthy as it showed mecha fighting under combined arms tactics, ranging from the infantry Spartan MBR-07-II to the jet fighter VF-1 Valkyrie and artillery Monster HWR-00-II.
One anime series that drew from the tradition of both super robot and real robot genres while being unique was Hideaki Anno's Neon Genesis Evangelion. Considered by many to be the spiritual successor to Space Runaway Ideon, Evangelion was highly successful and quite controversial, similar to its would-be predecessor.
The mecha genre in anime is still alive and well as the new millennium came, with revival OVAs like Getter Robo: the Last Day, Diebuster and Mazinkaiser from the Super Robot tradition, the new Gundam Seed series from the Real Robot side, and RahXephon, a successful sci-fi anime series in the vein of Brave Raideen.
Arguably, the concept of piloted mecha goes back decades before Tetsujin-28. The tripods featured in The War of the Worlds, with advanced weaponry and dedicated piloting stations, are perhaps the forerunners of modern mecha.