Streptococcus pneumoniae is a pathogenic bacterium and one of the leading causes of pneumonia. The first-line therapy for pneumonia typically involves the administration of empirical antibiotics. However, excessive use of antibiotics has triggered resistance to various drugs, highlighting the need for new, potential alternatives with antibacterial activity. In this context, traditional medicinal plants with antibiotic-like properties can be considered, one of which is garlic (Allium sativum L.), known to contain active compounds with antibacterial effects. The objective of this study was to identify the most potent active compound in garlic (Allium sativum) as an antibacterial agent against S. pneumoniae. The method used was an in silico test via molecular docking between garlic’s active compounds and the bacterial target protein, penicillin-binding protein 2 (PBP2). The results showed that the active compounds allicin, ajoene, S-allylcysteine, and alliin have antibacterial potential, with alliin showing the highest potential among them although still lower than the antibiotic benzylpenicillin. This study is based on in silico analysis and therefore requires further experimental validation.