The building up of cholesterol and various substances on the inner boundary of arterial walls forms a plaque (stenosis), which results in the narrowing of walls of arteries, and this exerts additional stress on the walls. Shear stress at the wall of arteries may cause the formation of plaque, plaque growth, and expansive arterial remodeling, and it may also result in an increased risk of plaque rupture. The purpose of this research work is to use machine learning approaches to analyze the wall shear stress and entropy generation through irreversible processes of blood flow in a porous stenosed artery within the context of magnetohydrodynamic consideration. As a way of illustrating blood’s non-Newtonian behavior, the Casson fluid model is used. A blood flow model in the context of mild stenosis has been developed, and it has subsequently been computationally addressed using an explicit finite difference method. The velocity, temperature, entropy generation, Bejan number, and wall shear stress are visualized for different values of pertinent variables. The result reflects the increased velocity in the stenosed region. A hybrid machine learning method using artificial neural network and particle swarm optimization is implemented to optimize the entropy generation and wall shear stress. The network is trained using Stochastic gradient–descent training procedure as well as Levenberg–Marquardt training procedure, and the outcomes of both training procedures are compared. Using this machine learning process, the minimum entropy production has been found for specific values of the Hartmann number, dimensionless temperature difference, and pulsatile component of pressure gradient. This machine learning-based optimization approach enhances the ability to forecast quantitative changes in affecting parameters, which will contribute to minimized damage to the arterial wall, improved blood flow efficiency and the delivery of necessary components to tissues.