The idea of the mech or giant piloted robot walking machine appears originally in Japanese anime, where there are several different versions, some more realistic and hard science, others fantastical and supernatural. These are called “real robots” and “super robots” respectively.
Super robots often tend to superhero silliness, although perhaps the most intelligent and thoughtful story of this gen.re are the Evas of the anime Neon Genesis Evangelion
Real robots (mechs as we understand them) in turn had a huge influence on Western role-playing and video games, specifically FASA’s Battletech universe and Mechwarrior games, which was directly inspired by Japanese anime (Macross etc) and where mecha are called battlemechs or ‘mechs. FASA mechs in turn were the inspiration for Metal Gear Solid, Titanfall, and many others of the same trope – all are gigantic (building-sized) piloted inanimate humanoid robots. Movie versions include the rather fragile AT walkers of Star Wars (incidentally FASA originally used the term “BattleDroid” but this violated Lucas Arts copyright) and the “jaegers” of Pacific Rim; the latter being Giullermo del Toro’s cinematic fanboy homage to Japanese mecha, with no influence from the FASA or post-FASA variant. (Trivia: in German, a jagpanzer is a “tank hunter” or anti tank armoured vehicle). The whole mecha trope and the its mythopoetic evolution deserves an entire essay of its own (which hopefully I will one day get around to writing!). Some mechs, like the FASA-inspired Titans of the Warhammer 40K universe in being themselves semi-sentient and alive.