The flux is the measure of the amount of field that passes through a given area.
The flux of a vector field $\vec f$ through a small area $d\vec A$ would be given by
$$ \vec f\cdot d\vec A=\vec f\cdot \hat n~dA $$
where $\hat n$ is a vector normal, i.e. perpindicular to the surface.
To get the total flux through a surface we use a surface integral:
$$ \Phi_S=\int_S\vec f\cdot d\vec A =\braket{f_\perp}_SA $$
In general a surface can be defined with two parameters, $u$ and $v$. The surface can be represented by the parameterization $\vec r(u,v)$. For this parameterization, the differential area vector is then given by
$$ d\vec A=d\vec r_u\times d\vec r_v=\frac{\partial \vec r}{\partial u}\times \frac{\partial \vec r}{\partial v}dudv $$
$d\vec r_u=\frac{\partial \vec r}{\partial u}du$ gives the change in $\vec r$ if we take a tiny step in the $u$ direction and $d\vec r_v=\frac{\partial \vec r}{\partial v}dv$ gives the change in $\vec r$ if we take a tiny step in the $v$ direction. These provide two tangent vectors forming a tangent plane on the surface $S$.
→ The cross product of these two vectors will give a vector normal to the tangent plane and thus the surface at that point.
→ The cross product magnitude also gives us the area spanned by these two tangent vectors
Idea: Divergence measures the amount of field coming out (source) or going in (sink) at a particular point. In essence the divergence is limit of the flux through a closed surface $S$ as the volume enclosed by that surface $S$ becomes infinitesimal.
Divergence has a very special relationship with the flux through a surface. If you were to add up the divergence for all the points enclosed in a surface this would be equivalent to the flux across the surface
$$ \int_V(\vec\nabla\cdot\vec f)dV=\oint_S\vec f\cdot d\vec A\\ \int_V(\vec\nabla\cdot\vec f)dV=\Phi_s\\ \braket{\vec\nabla\cdot\vec f}VV=\braket{f\perp}_SA $$
The average amount of source or sinks times the volume $V$ is equivalent to the average amount of field perpindicular to the surface times the surface area, i.e. the flux!