The potential formulation has significant advantages over field formulation in solving complicated problems in electromagnetic field theory. One essential part of electromagnetic field theory’s potential formulation is gauge invariance and gauge theories because it provides an extra degree of freedom. By using this extra degree of freedom, we can solve complicated electromagnetic problems quickly. Thus, it is necessary to include a systematic explanation of gauge theories in teaching electromagnetic theory. However, textbooks usually formulate gauge theories by using Maxwell’s equations of electromagnetism, by using vector calculus identities. However, this method of formulation of gauge theories does not give a clear idea about the origin of gauge theories and gauge invariance in electromagnetism. Here the author formulates gauge theories from wave equations of the electric and magnetic fields instead of directly using Maxwell’s equations. This method generalizes all gauge theories like Lorenz gauge theory, Coulomb gauge theory, Etc. Gauge theory, because of the way the author derives it, gives a distinct idea about the mathematical origin of the gauge theories and gauge invariance in electromagnetic field theory. Thus, the author reviews the origin of gauge theories in electromagnetic field theory and develops a distinct and effective method to introduce gauge theory in the teaching of electromagnetic field theory that can provide better understanding of the topic to undergraduate students.