To understand the effects of H of hydrocarbon precursors and alloying elements of catalysts on the initial growth of carbon nanomaterials, this work combined first-principles (FP) calculation and machine learning (ML) methods to study the adsorption of complete hydrocarbon molecules on various alloy surfaces. Specifically, we calculated the energetics and geometries of the adsorption of acetylene (C2H2) molecules on the pristine Ni, Co, and Fe metal and a benzene molecule on Ni-X [X = thirty 3d, 4d, and 5d transition metal (TM) elements] alloy surfaces. The results suggest that benzene has larger adsorption energies on Ni-X (X = Y, Cd, Sc, Lu, Ag, Ti, Hg, Pd, Zn, V, Cu, and Au) than that on the pristine Ni surface. Furthermore, the ML models were constructed using the surface “Center-Environment” (SCE) features to predict the FP results. The ML models suggest that the features critical to adsorption energies include the size, electronegativity, and valence of the doping element. We proposed an “add and dehydrogenate” mechanism underlying the initial growth of nanocarbon with hydrocarbon precursors. These results provide a theoretical basis in the design of alloy catalysts including in-plane single atom catalysts.