The direction of flow of electrons is indeed opposite to the direction of conventional electric current. This convention was established historically before the true nature of electric current and the behavior of electrons were fully understood.
In the late 18th century, when the concept of electric current was first being investigated, scientists hypothesized that a fluid called "electric fluid" flowed from positive to negative terminals in a circuit. This fluid theory was based on analogies with the flow of water in pipes, where the direction of water flow is from higher pressure (positive pressure) to lower pressure (negative pressure).
Later, as the understanding of electricity progressed, it was discovered that electric current is actually the movement of charged particles, primarily electrons, in a conductor. Electrons are negatively charged particles, and in most conductive materials, they are the charge carriers that move in response to an electric field.
However, by the time this understanding emerged, the convention of current flow had already been established. To avoid confusion and maintain consistency with earlier work, the convention of "conventional current" was retained. According to this convention, current is considered to flow from the positive terminal of a power source to the negative terminal, even though it is actually the electrons (negatively charged) that are moving in the opposite direction.
It's important to note that the choice of convention does not affect the actual physical behavior of electrons or the functioning of electrical circuits. Whether we consider the flow of positive charges or the movement of electrons, the equations and principles of electrical circuit analysis remain the same. The convention of current flow provides a standardized reference frame for understanding and analyzing electrical circuits.