Infectious diseases can have a significant economic impact, both in terms of healthcare costs and lost productivity. This can be particularly significant in developing countries, where infectious diseases are more prevalent, and healthcare systems may be less equipped to handle them. It is recognized that the hepatitis B virus (HBV) infection remains a critical global public health issue. In this study, we develop a comprehensive model for HBV infection that includes vaccination and hospitalization through a fractional framework. It has been shown that the solutions of the recommended system of HBV infection are positive and bounded. We examine the steady states of the model and determine the basic reproduction number; denoted by R0. The qualitative and quantitative behavior of the model is demonstrated using mathematical skills and numerical techniques. It has been proved that the infection-free steady state of the system is locally asymptotically stable if R0<1 and unstable otherwise. Furthermore, the Ulam–Hyers stability (UHS) of the recommended fractional models is investigated and the significant conditions are provided. We present an iterative technique to visualize the dynamical behavior of the system. We perform different simulations to illustrate the effect of different input factors on the solution pathways of the system of HBV infection to conceptualize the role of parameters in the control and prevention of the infection.