The extraordinary optoelectronic performance of hybrid organic–inorganic perovskites has resulted in extensive efforts to unravel their properties. Recently, observations of ferroic twin domains in methylammonium lead triiodide drew significant attention as a possible explanation for the current–voltage hysteretic behaviour in these materials. However, the properties of the twin domains, their local chemistry and the chemical impact on optoelectronic performance remain unclear. Here, using multimodal chemical and functional imaging methods, we unveil the mechanical origin of the twin domain contrast observed with piezoresponse force microscopy in methylammonium lead triiodide. By combining experimental results with first principles simulations we reveal an inherent coupling between ferroelastic twin domains and chemical segregation. These results reveal an interplay of ferroic properties and chemical segregation on the optoelectronic performance of hybrid organic–inorganic perovskites, and offer an exploratory path to improving functional devices.