This study presents an extensive experimental and theoretical analysis of Mg -doped hydroxyapatite (HAp) samples with additional Sm doping at varying amounts. A wet chemical method was used to synthesize Mg-containing HAps at a constant amount of 0.133 at. %, and in addition the second dopant of Sm was utilized at varying amounts of 0.133, 0.266, 0.399, 0.532, and 0.665 at. %. All of these samples were investigated experimentally and theoretically by using the X-ray diffraction (XRD) analysis, Fourier transform infrared (FTIR) spectroscopy, scanning electron microscopy (SEM), Raman spectroscopy, differential thermal analysis (DTA), thermogravimetric analysis (TGA), in-vitro cell viability tests, and density functional theory (DFT) calculations. The bandgap energy was found to have reduced from 4.6115 eV to 4.3870 eV. The linear attenuation (or absorption) coefficient increased as the amount of Sm in the sample increased, and this parameter decreased as the photon energy increased for all samples. Both the lattice parameter and the theoretical density increased, whereas the unit cell volume and the lattice parameters declined. The XRD and FTIR results revealed that the HAp phase (over 98 percent for all samples) was a major phase formed, while the beta -TCP phase (beta-tricalcium phosphate) was a minor phase. The beta-TCP phase increased from 0.91 to 1.57 percent with an increasing amount of Sm. The volume of the unit cell trended in the same direction as predicted by the obtained results theoretically. Increased anisotropic energy density and a decrease in crystallinity have been observed. All samples were found to be thermally stable. Due to the presence of Sm content, cell viability was observed to be affected.