The boundary-layer equations for mass and heat energy transfer with entropy generation are analyzed for the two-dimensional viscoelastic second-grade nanofluid thin film flow in the presence of a uniform magnetic field (MHD) over a vertical stretching sheet. Different factors, such as the thermophoresis effect, Brownian motion, and concentration gradients, are considered in the nanofluid model. The basic time-dependent equations of the nanofluid flow are modeled and transformed to the ordinary differential equations system by using similarity variables. Then the reduced system of equations is treated with the Homotopy Analysis Method to achieve the desire goal. The convergence of the method is prescribed by a numerical survey. The results obtained are more efficient than the available results for the boundary-layer equations, which is the beauty of the Homotopy Analysis Method, and shows the consistency, reliability, and accuracy of our obtained results. The effects of various parameters, such as Nusselt number, skin friction, and Sherwood number, on nanoliquid film flow are examined. Tables are displayed for skin friction, Sherwood number, and Nusselt number, which analyze the sheet surface in interaction with the nanofluid flow and other informative characteristics regarding this flow of the nanofluids. The behavior of the local Nusselt number and the entropy generation is examined numerically with the variations in the non-dimensional numbers. These results are shown with the help of graphs and briefly explained in the discussion. An analytical exploration is described for the unsteadiness parameter on the thin film. The larger values of the unsteadiness parameter increase the velocity profile. The nanofluid film velocity shows decline due the increasing values of the magnetic parameter. Moreover, a survey on the physical embedded parameters is given by graphs and discussed in detail.