Why is electric flux defined as $\Phi = E \cdot S$?

A very good example to understand flux, any kind of flux:-

Imagine that it is raining.

Let the rain fall in a direction denoted by unit vector $\vec v$, with a rain intensity of $I\frac { litres}{m^2}$. In this rain, you are holding a vessel with a plane open area on one side. Take $\vec A$ as a vector perpendicular to the plane of the open area of the vessel, having the same magnitude as the area.

Now the flux of rain through that open area is defined as the total volume of water which goes through the open area at any moment.
If the plane of the area was perpendicular, flux would be given by $$\Phi = I|\vec A|$$ But if the area is at any general angle, we would say $$\Phi = I|\vec A|\cos\theta$$ where $|\vec A|\cos\theta$ is the projection of the area perpendicular to the direction of rainfall. Thus $\theta$ is the angle $\vec A$ makes with $\vec v$. Using the definition of Dot Product, I can generalize this as $$\Phi = I\vec v\cdot\vec A$$ I can also write $I\vec v$ as the intensity vector $\vec I$(note that $|\vec v|=1$ as it is a unit vector), giving me finally $$\Phi = \vec I\cdot\vec A$$

This same analogy can be used to understand electric flux, because the electric field $\vec E$ is nothing but the electric field INTENSITY. Thus for electrostatics you get $$\Phi = \vec E\cdot\vec A$$


When the notions of electric and magnetic fields were conceptualized, they imagined that there was an invisible fluid being pushed around by charges, and they leveraged some of the equations and terminology of fluid mechanics.

The modern understanding of fields has largely gotten rid of this picture, but some colorful langauge like "electric flux" remains. If you want to picture positive charge as "amount of fluid added to region per unit time" and negative charge as "amount of fluid removed from region per unit time", you can, but this thinking only gets you so far. Safer to just think of it as an abstract mathematical definition.