An example of a symmetry transformation for certain Lagrangians (notably the canonical complex scalar field Lagrangian) is multiplication of the fields by a complex phase. When we multiply the fields by a spacetime-dependent phase and demand that the Lagrangian is left unchanged under the transformation, then we must introduce a new gauge field, and this field is nothing but the photon field, which is a combination of the vector potential A and the scalar potential φ.

Furthermore, from the Lagrangian, we can derive the equations of motion for the fields, and in the example just mentioned, the equations are indeed the Maxwell equations. And since for every symmetry, there is a conserved quantity, the conserved quantity there is electric charge. Can you please explain why it turns out to be electric charge?