Not much is known about the nature of hardness science in fundamental studies. In order to unravel the mystery on hardness science in fundamental studies, we have tried to gain computational insights into the relation between elements’ physical properties and mechanical properties of hard materials via machine learning. We have systematically analyzed two LASSO-regression machine learning models with regard to the Debye temperature and Vickers hardness values of 3d, 4d, and 5d transition metal carbides MC (M = Ti, V, Cr, Mn, Fe, Co, Ni, Zr, Nb, Mo, Tc, Ru, Rh, Pd, Hf, Ta, W, Re, Os, Ir, and Pt) in five different crystal structures (NaCl-type, WC-type, ZnS-type, CsCl-type, and NiAs-type structures), using first-principles calculations based on the density functional theory. Using machine learning, we have made it clear that the following explanatory variables are important to hardness: atomic number, Mendeleev number, Martynov–Batsanov electronegativity, heat of vaporization, thermal conductivity, equilibrium volume, and formation enthalpy. They can be divided into three categories: number of valence electrons, electronegativity, and thermal property, because atomic number and Mendeleev number belong to the role of number of valence electrons, and because heat of vaporization, thermal conductivity, equilibrium volume, and formation enthalpy fall into thermal property. Our results indicate that the number of valence electrons, electronegativity, and thermal property of materials are the factors in enhancing hardness.