Groundwater is an important element of the hydrological cycle and has increased in importance due to insufficient surface water supply. Mismanagement and population growth have been identified as the main drivers of water shortage in the continent. This study aimed to derive a groundwater potential zone (GWPZ) map for Nelson Mandela Bay (NMB) District, South Africa using a geographical information system (GIS)-based analytic hierarchical process (AHP) and machine learning (ML) random forest (RF) algorithm. Various hydrological, topographical, remote sensing-based, and lithological factors were employed as groundwater-controlling factors, which included precipitation, land use and land cover, lineament density, topographic wetness index, drainage density, slope, lithology, and soil properties. These factors were weighted and scaled by the AHP technique and their influence on groundwater potential. A total of 1371 borehole samples were divided into 70:30 proportions for model training (960) and model validation (411). Borehole location training data with groundwater factors were incorporated into the RF algorithm to predict GWPM. The model output was validated by the receiver-operating characteristic (ROC) curve, and the models’ reliability was assessed by the area under the curve (AUC) score. The resulting groundwater-potential maps were derived using a weighted overlay for AHP and RF models. GWPM computed using weighted overlay classified groundwater potential zones (GWPZs) as having low (2.64%), moderate (29.88%), high (59.62%) and very high (7.86%) groundwater potential, whereas GWPZs computed using RF classified GWPZs as having low (0.05%), moderate (31.00%), high (62.80%) and very high (6.16%) groundwater potential. The RF model showed superior performance in predicting GWPZs in Nelson Mandela Bay with an AUC score of 0.81 compared to AHP with an AUC score of 0.79. The results reveal that Nelson Mandela Bay has high groundwater potential, but there is a water supply shortage, partially caused by inadequate planning, management, and capacity in identifying potential groundwater zones.