Cardiovascular diseases (CVDs) are the leading cause of mortality worldwide, and their prevalence is rising, particularly in developing countries. In Nigeria, the high burden of CVDs is exacerbated by non-traditional risk factors such as economic hardship, stress, and environmental challenges. This study developed a machine learning-based prognostic model for the early detection of heart attack risk using the Life Course Theory, considering both biological and non-biological factors unique to the Nigerian population. Data were collected from healthcare institutions in southwestern Nigeria, preprocessed, and analyzed using a variety of machine learning algorithms, including Naïve Bayes, Support Vector Machine (SVM), and Decision Trees. The models were evaluated using accuracy, recall, precision, and F1score metrics. The study’s results demonstrate the potential of machine learning to significantly enhance the early detection of heart attacks, particularly in low-resource settings with SVM having 82% accuracy.