In the quest for novel antiviral agents, a new set of fourteen pyrimidine and pyridopyrimidine derivatives (4–11) have been synthesized via different chemical transformations starting from 1,3-indandione 1. These derivatives were characterized by 1H NMR, 13C NMR, FT-IR, and MS. Following the in vitro evaluation of some derivatives of these synthetic compounds against HSV-1, the most promising compounds, 4b and 6, had their mechanisms of action examined. The most potent compounds (4b and 6) were also examined by applying density-functional theory (DFT) to ascertain their molecular structures and geometries. Molecular docking studies for compounds 4b, 5b, and 6 were performed against the Herpes simplex virus type-1 target proteins (PDB ID: 2GIY, 2KI5, and 3FOT) to anticipate the antiviral active sites of the compounds under investigation. Docking results and the compound's strong contact with the target proteins indicated that compounds 4b and 6 had energy scores that were on par with or higher than those of the acyclovir drug. Both in silico and in vitro results are in agreement.