In Seiberg-Witten theory, the group of gauge transformations is $Map(M,S^1)$.
For a configuration $(A,\psi)$, where $A$ is a unitary connection on the determinant line bundle, $\psi$ is a spinor, and $g:M\to S^1$ a change of gauge, we have
$(g, (A,\psi)) = (gAg^{-1} - g^{-1}dg, g\psi)$.
Where do we get this action from, and why is this the correct action to look at?
P.S. Remarks on notation: $g^{-1}$ is not the inverse map, but the map $x\mapsto g(x)^{-1}$. Also people usually write just $A - g^{-1}dg$ since $U(1)$ is abelian but I'm writing it with $gAg^{-1}$ to make clear I know what the expression means, I just wanna know how we derive it.
If you are asking for a physicists point of view, the argumentation is usually as follows:
So you want to formulate an action for sections $\psi$ in some vector bundle, say you write something like $$ S[\psi]=\int\overline{\psi}~i\gamma^\mu\partial_\mu\psi $$ in physicists notation (local coordinates). So formally, this is invariant if you replace $\psi\mapsto\text{e}^{i\alpha}\psi$ with $\alpha\in\mathbb{R}$, or similarly, other "constant gauge transformations" depending on where $\psi$ should take values. Then physicists say (e.g. in an undergrad QFT lecture), that "for some relativistic reasons" any global gauge symmetry must be a local one, formally, that $\alpha$ should be allowed to be a function on spacetime. Then the above action is not invariant anymore, but replacing it by something like $$ S[\psi,A]=\int\overline{\psi}~i\gamma^\mu(\partial_\mu+iA_\mu)\psi+\mathcal{L}_\text{free}(A_\mu) $$ with another field $A_\mu$. This is invariant under $\psi\mapsto\text{e}^{i\alpha}\psi$ with $\alpha:M\to\mathbb{R}$ if you additionally claim that $A$ transforms as $A_\mu\mapsto A_\mu\pm \partial_\mu\alpha$ (i don't remember the sign). Hereby, $\partial_\mu+iA_\mu$ is called covariant derivative.
If $\psi$ is a section in some vector bundle, $g\psi$ is just the gauge transformed section, where simultaneously the connection form part of the configuration transforms as connection forms usually do, and your functional depending on $\psi$ and $A$ should be invariant under simultaneously transforming them both.
From a more mathematical point of view, you need to choose a connection form/a gauge in order to take derivatives in a vector bundle and the physics should not depend on this choice. Moreover, in a vector bundle two covariant derivatives are connected via a vector bundle automorphism/gauge transformation. These automorphisms can be identified with elements of your group $\text{Map}(M,G)$, acting as $\psi\mapsto g\psi$. On the other hand, this vector bundle automorphism can be associated with a principal bundle automorphism of the frame bundle (aka gauge transformation), and this gauge transformation acts on local connection forms as $A\mapsto gAg^{-1}-g^{-1}\text{d}g$. So on a configuration $(A,\psi)$, a gauge transformation acts by simultaneously transforming $\psi\mapsto g\psi$ and $A\mapsto gAg^{-1}-g^{-1}\text{d}g$ and invariance under this action guarantees that the physics does not depend on the choice of covariant derivative.
So you said "I just wanna know how we derive it", I don't know whether it can be derived in the sense that it necessarily must look like that, but I can give you the above physical motivation why an action like this is meaningful/worthy to be studied.