Infection with the hepatitis B virus (HBV) is a global health problem and may be controlled via appropriate treatment. We use fractional models to understand infectious diseases because fractional models help us understand treatments' effects on hepatitis B better than integer‐order models. In this article, we introduce a new mathematical model for HBV based on the fractal–fractional derivative with a generalized Mittag–Leffler kernel. Firstly, we discuss the fundamental properties, like the equilibria of the model and the primary reproduction number. Then, we investigate the existence of a unique solution to our model. We use an iterative method to solve the proposed model. Further, we discuss the stability of the model through stability theory. Finally, we offer some graphical illustrations for various values of the parameters.