Happiness is a state of contentment, joy, and fulfillment, arising from relationships, accomplishments, and inner peace, leading to well-being and positivity. The greatest happiness principle posits that morality is determined by pleasure, aiming for a society where individuals are content and free from suffering. While happiness factors vary, some are universally recognized. The World Happiness Report (WHR), published annually, includes data on ‘GDP per capita’, ‘social support’, ‘life expectancy’, ‘freedom to make life choices’, ‘generosity’, and ‘perceptions of corruption’. This paper predicts happiness scores using Machine Learning (ML), Deep Learning (DL), and ensemble ML and DL algorithms and examines the impact of individual variables on the happiness index. We also show the impact of COVID-19 pandemic on the happiness features. We design two ensemble ML and DL models using blending and stacking ensemble techniques, namely, Blending RGMLL, which combines Ridge Regression (RR), Gradient Boosting (GB), Multilayer Perceptron (MLP), Long Short-Term Memory (LSTM), and Linear Regression (LR), and Stacking LRGR, which combines LR, Random Forest (RF), GB, and RR. Among the trained models, Blending RGMLL demonstrates the highest predictive accuracy with R2 of 85%, MSE of 0.15, and RMSE of 0.38. We employ Explainable Artificial Intelligence (XAI) techniques to uncover changes in happiness indices, variable importance, and the impact of the COVID-19 pandemic on happiness. The study utilizes an open dataset from the WHR, covering 156 countries from 2018 to 2023. Our findings indicate that ‘GDP per capita’ is the most critical indicator of happiness score (HS), while ‘social support’ and ‘healthy life expectancy’ are also important features before and after the pandemic. However, during the pandemic, ‘social support’ emerged as the most important indicator, followed by ‘healthy life expectancy’ and ‘GDP per capita’, because social support is the prime necessity in the pandemic situation. The outcome of this research helps people understand the impact of these features on increasing the HS and provides guidelines on how happiness can be maintain during unwanted situations. Future research will explore advanced methods and include other related features with real-time monitoring for more comprehensive insights.