# Vector potential in gauge transformation

While applying Gauge transformation, $\psi\prime = U \psi$ , where $U= e^{i q \lambda(x)}$ , transformation law for "Vector Potential" comes out to be : $$A_{\mu}\prime= UA_{\mu}U^{-1}-\dfrac{i}{q}(\partial_{\mu}U)^{-1}U.$$ The book I am referring, derives this using the argument that if $\psi\prime = U\psi$, then this implies $$D_{\mu}\prime \psi\prime= U(D_{\mu}\psi) .$$ Can anybody explain the origination and meaning of this assumption?

I would say that $D_\mu '\psi' = U(D_\mu \psi)$ is a requirement, rather than an assumption:
When $U$ is a global transformation (i.e., when $\lambda$ is independent of $x$), we have trivially $\partial_\mu \psi' = U(\partial_\mu \psi)$, and so $(\partial_\mu \psi)^\dagger (\partial_\mu \psi) = (\partial_\mu \psi')^\dagger (\partial_\mu \psi')$.
We define the 'covariant derivative' $D_\mu$ by requiring that $D_\mu \psi$ transforms in the same way under local transformations, $D_\mu' \psi' = U (D_\mu \psi)$, and so the corresponding combination $(D_\mu \psi)^\dagger (D_\mu \psi)$ is invariant under these.
The simplest way to do this is minimal coupling: define $A_\mu$ transforming as you state and set $D_\mu = \partial_\mu - i q A_\mu$.