The structural, stability, thermodynamic, mechanical, and electronic properties of Y and Sb doped into Mg2Si were studied by first principles. The results show that the stable structures are Mg7Si4Y, Mg8Si4Sb, Mg6Si4YSb, and Mg7Si4YSb. Mg8Si4Sb has the largest ductility among them. Y doping causes strong orbital hybridization between Mg (2p) and Y (4d), while Sb doping causes strong orbital hybridization between Mg (2p), Si (3p), and Sb (5p). However, the thermal conductivity and hardness of Mg2Si will be reduced by Y and Sb doping. The conductivity of Mg8Si4Sb is the best. The anisotropy of the {100}, {010}, and {001} surfaces will increase once doped with Y or Sb. Mg8Si4Sb has the highest degree of anisotropy.