Like Johnny Cash, all the robots walk a line. WALL-E compacts trash. EVE scans for plant life. But M-O walks a literal line, a green line that leads to the EVE probes. It's his job to scrub them of "foreign contaminant," i.e. dirt from Earth, with the help of his Vacu-Bot, Spray-Bot, and Buffer-Bot.
When M-O scans WALL-E, he is shocked to discover a creature covered in 100% Foreign Contaminant. "Whoa, whoa, whoa, whoa, whoa," he says, and he makes it his life's mission to scrub WALL-E to a new shine.
In order to the do that, though, M-O must step off the line. WALL-E's filthy treads deviate from the line, and M-O decides to follow them instead of his pre-programmed directive. By the time M-O reaches WALL-E and cleans in, in the Axiom's dump, M-O is just a dirty as WALL-E is. The two exchange names, and a new friendship is born.