The earliest notable example is The Iron Man (1918), a silent serial where the protagonist fights crime using a powered exoskeleton. While not "Transformers"-style transforming robots, it pioneered the "human in mechanized armor" trope.
Other early candidates (less direct): The Master Mystery (1919, Houdini vs. automaton), Metropolis (1927, false Maria robot). But The Iron Man best fits "humans fighting in transformer-looking machines" for its era.