Identifying the key factors governing the selectivity of CO2 hydrogenation catalysts remains a formidable challenge. Herein, we elucidate the complex interaction between active sites nanostructure and selectivity in CO2 hydrogenation through in-depth characterization and theoretical simulations. NiIn alloy formed on the Ni facets with hydrogen reduction, constructing a core-shell-like structure. Ni-mediated methane formation was suppressed almost entirely upon alloying with indium, allowing the reaction pathway shifted from methanation into the reverse-water-gas-shift (RWGS). On the contact surface, In restricted CO adsorption on Ni, thereby preventing methane generation from CO via successive hydrogenation. DFT calculations confirmed that Ni and CO are negatively charged and repel each other due to electron transfer from indium, resulting in a decrease in adsorption energy, which is crucial for the pathway shift. Understanding the regulation of Ni-In structure in product distribution is expect to provide valuable insights into the precise design of catalysts with controllable product selectivity.