Volume $V=\pi r^2 h$.
Surface area $$S =2 \pi r h +2 \pi r^2$$
Now, the AM-GM inequality says
$$\frac{ \pi r h + \pi rh +2 \pi r^2}{3} \geq \sqrt[3]{\pi r h \cdot \pi rh \cdot2 \pi r^2}= \sqrt[3]{2 \pi V^2 }$$
with equality if and only if $ \pi r h = \pi rh =2 \pi r^2$.
Basically, it boils down to this simple principle (which is more or less AM-GM): if some expressions have a constant product, their sums is minimal if the functions are equal (if they can be equal).
One model for your solid is to take a plane region $D$ of area $A$, to take a real-valued (and, say, continuous) function $f$ with domain $D$, and to let the cylinder be the set of points $(x, y, z)$ such that
$$
(x, y) \in D,\qquad
f(x, y) \leq z \leq f(x, y) + H.
$$
The volume of the cylinder is $AH$, independently of $f$, as you've observed.
One natural geometric interpretation of this formula is the height over an arbitrary point of $D$ multiplied by the area of the projection of the cylinder on the $(x, y)$-plane.
This type of formula holds in greater generality. If $f$ is a continuous function of $(n - 1)$ variables, then the "pointwise shearing" homeomorphism
$$
(x_{1}, \dots, x_{i}, \dots, x_{n}) \mapsto
(x_{1}, \dots, x_{i} + f(x_{1}, \dots, x_{i-1}, x_{i+1}, \dots, x_{n}), \dots, x_{n})
\tag{1}
$$
preserves $n$-dimensional volume. If you start with the closure $C$ of an arbitrary bounded open subset of $\mathbf{R}^{n}$ and repeatedly apply transformations of the type (1), the resulting image has the same volume as $C$.
Your cylinder with non-flat base is the image of a "standard" cylinder $C = D \times [0, H]$ under
$$
(x, y) \mapsto \bigl(x, y, z + f(x, y)\bigr).
$$
Best Answer
$$2\pi rh=2\frac{\pi r^2h}r=2\frac Vr$$