How did Maxwell's theory of electrodynamics contradict the Galilean principle of relativity? (Pre-special relativity) The Galilean principle of relativity:

The laws of classical mechanics apply in all inertial reference systems

OR 

No experiment carried out in an inertial frame of reference can determine the absolute velocity of the frame of reference

These two statements written above are equivalent.
Maxwell's equations were discovered later. My question is (1) how did Maxwell's equations contradict the Galilean principle of relativity?
Furthermore if one studies the two postulates of Einstein's special theory of relativity, they can be simply translated as follows:
Postulate 1: Galileo was right.
Postulate 2: Maxwell was right. 
(2) How did the Maxwell equations retain the same form in all inertial frames by obeying the Lorentz transformation?
 A: A Galilean set of frames are an obvious/common sense way of viewing motion  if we  assume the validity of  3 also apparently obvious postulates.


*

*All clocks measure time at the same rate, independent of their velocity.

*Objects have no limit on their potential velocity.

*Rulers have the same length (difference in position between the lengths at a common time), independent of their velocity.
When Maxwell formulated/compiled  his equatons,  implying that light speed was invariant  in every frame,  Einstein was forced to consider the implications of this for Galilean transformations and their "obvious" underlying assumptions.
If light speed is invariant in all frames, then something has to give to preserve that invariance, and the 3 assumptions above needed to be abandoned to preserve Maxwell's laws.  

How the Maxwell equations retained the same form in all inertial frames by obeying Lorentz transformation?

By the development of the Faraday tensor $F_{\mu v}$ based on  a vector potential $\vec A $ and a scalar potential $\Phi $ . 
A: The direct answer is that they did not and your question is simply false.
Your question is based on several widespread misconceptions and folklore myths (i.e. "fake news" or "fake history") - many of which have been passed around even within the Physics community - including the following: (1) that Maxwell's equations are actually Maxwell's, (2) that Maxwell's equations have the Lorentz group solely as its symmetry group, and many other misconceptions borne of the myth and folklore that's arisen by the "telephone tag" that's been played with the older literature.
(1) The equations today called "Maxwell's Equations" are an historical evolution and refinement from what Maxwell originally wrote, that have passed through many hands and revisions and alterations, including Heaviside, Helmholtz, Hertz, Lorentz in the 19th century; Einstein, Minkowski and others in the 20th. Much of what we now recognize as Maxwell's equations you would barely recognize in Maxwell's treatise as such, and would only recognize in his earlier papers with a great deal of effort.
Amongst the many changes. (a) Maxwell used the electric and magnetic potential that was mostly discarded and neglected by his contemporaries and followers throughout the 19th century, and (b) he used the Coulomb gauge, by the way, though he didn't list it in profile with his other equations. (c) He drew a (mostly) clear distinction between $(,)$ and $(,)$ fields that others (notably Hertz, Lorentz to some degree) tried to negate, but (d) still tended to confuse $$ and $$ fields (a habit that was a holdover from his pre-treatise days), which led to the wrong constitutive law that had to later be corrected by Thomson. They have different transformation properties: $$ transforms as the components of a 2-form, while $$ transform as the components of a 1-form. A similar observation applies to $$ and $$. This omission - one of several mistakes in his treatise - partially contributed to the confusion of the issue down the line.
(2) (e) The equations Maxwell actually wrote were not Lorentz invariant, but Galilean invariant, except for the omission in the constitutive relation for $$ versus $$. When the constitutive laws are excluded from the list, then Maxwell's equations can be written in a form that is invariant under all coordinate transformations involving $(x,y,z,t)$, not just $(x,y,z)$. They are diffeomorphism invariant. This invariance is fully brought out when they are written using differential forms.
(f) Maxwell used differential forms, more so than vectors, to write his equations - both in the treatise and in his pre-treatise works; but did not make full use of the Grassmann algebra that we normally use with them today; though he did use it to a limited degree in the treatise, e.g. by writing $dx dy = -dy dx$ or, as we would today write it, $dx \wedge dy = -dy \wedge dx$.
His differential forms, however, were limited only to the spatial coordinates, and would therefore have only been served as a presentation suitable for arbitrary coordinate transformations involving the spatial coordinates only. His differential forms, when written today, would be the following:
$$E₃ ≡ ·d = E_x dx + E_y dy + E_z dz, B₃ ≡ ·d = B^x dy \wedge dz + B^y dz \wedge dx + B^z dx \wedge dy,$$
$$H₃ ≡ ·d = H_x dx + H_y dy + H_z dz, D₃ ≡ ·d = D^x dy \wedge dz + D^y dz \wedge dx + D^z dx \wedge dy,$$
$$A₃ ≡ ·d = A_x dx + A_y dy + A_z dz, J₃ ≡ ·d = J^x dy \wedge dz + J^y dz \wedge dx + J^z dx \wedge dy,$$
$$Q₃ ≡ ρ dV.$$
where
$$d = (dx,dy,dz),$$
$$d = (dy \wedge dz, dz \wedge dx, dx \wedge dy),$$
$$dV = dx \wedge dy \wedge dz,$$
is used to express the differential forms in Cartesian coordinates.
He failed to notice that they pair off to form the differential forms
$$A ≡ A₃ - φ dt, F ≡ B₃ + E₃ \wedge dt,$$
$$G ≡ D₃ - H₃ \wedge dt, Q ≡ Q₃ - J₃ \wedge dt,$$
which he could have discovered by completely (and correctly) carrying out his analysis of the transformation properties of the various fields.
Maxwell's equations, minus the constitutive laws, can be written as
$$dA = F ⇒ dF = 0,$$
$$dG = Q ⇒ dQ = 0,$$
the second of each set following from the first. These are invariant under all space-time coordinate transforms. When written in terms of a Cartesian inertial frame they take on the familiar form that is originally attributed to Heaviside
$$\{  = -∇φ - {∂ \over ∂t},  = ∇× \} ⇒ \{ ∇· = 0, ∇× + {∂ \over ∂t} =  \},$$
$$\{ ∇· = ρ, ∇× - {∂ \over ∂t} =  \} ⇒ \{ ∇· + {∂ρ \over ∂t} = 0 \}.$$
(g) The 4-dimensionality of the Maxwell equations has absolutely nothing to do with Minkowski's formulation of 4-dimensional geometry. The idea that this is where/how the 4-dimensionality of the equations arises is a huge folklore myth; one of the most serious of them all.
In fact, these equations are the equations that hold in a Relativistic world, but also in a non-Relativistic world and even (as you will see below) in a Carrollean world or a Euclidean 4-D timeless space.
(h) The constitutive law that Maxwell (once Thomson's correction is added), Lorentz, Heaviside, Hertz, Helmholtz all used is equivalent to the following
$$ = ε( + ×),  = μ( - ×).$$
The velocity $$ identities the velocity associated with the unique frame in which the constitutive laws assume their isotropic form
$$ = ε,  = μ.$$
The isotropic frame in pre 20th century literature and in the early 20th century up to (and including) Einstein's 1905 Special Relativity paper was called the "stationary frame". (Lorentz, used $-$ instead of $$ and Maxwell used $$ in his treatise interchangeably with $$, even in the same section in some places.) This is what the "moving" in "On the electrodynamics of moving bodies" actually refers to. He called out the $$ vector in the opening section of his paper, but not symbolically or by name. Had he named it, he probably would have used Lorentz's $$ as the name. He was most certainly aware of what his contemporaries were doing, since he had already written 23 reviews of other's papers in Annalen de Physik during the 1904-1905 period, which would can read for yourself in the archive of Einstein's writings on line at Princeton (https://einsteinpapers.press.princeton.edu/). So, I'm not sure why he neglected to do a more detailed comparative survey of the related works, in his paper and make more direct reference to these specifics.
These equations are not Lorentz covariant, but Galilean covariant! Maxwell's equations, before Einstein, were covariant with respect to Galilean transforms. That includes Lorentz's treatment, notwithstanding his attempt at doing the Lorentz transform fix to try and recover the stationary form of the equations for all frames in the vacuum. His equations were still Galilean covariant, because of the absence of the extra relativistic terms on the left in his constitutive laws.
(h) The Relativistic form of the constitutive laws - as laid out by Minkowski in 1908 and Einstein and Laub also in 1908 - are
$$ + {1 \over c²} × = ε( + ×),  - {1 \over c²} × = μ( - ×).$$
This set of equations with this form of the constitutive laws, today, is known as the Maxwell-Minkowski Equations.
The extra terms on the left distinguish the Relativistic from the non-Relativistic versions of the constitutive law. They also have the feature that $$ becomes entirely superfluous if $|| < c$, whenever $εμ = 1/c²$. Under that condition the equations are equivalent to the "stationary form" (as you can verify).
Einstein himself (as well as Minkowski in his 1908) paper made this point fairly clearly; with Einstein specifically pointing out that Lorentz's equations were not Lorentz covariant, but Galilean covariant, on account of the absent terms. The same applies to the formulations of the other 19th century predecessors.
These constitutive laws describe a connection between the two sets of fields that is suitable for "moving media" - e.g. material media, like water or even air, with a sublight wave speed and a fixed frame of isotropy.
Maxwell's equations with the Galilean version of the constitutive laws can be written by solving for $$ and $$:
$$ = { \over ε} - ×,  = { \over μ} + ×,$$
and back-substituting in the other equations to write
$${ \over ε} = -∇φ - {∂ \over ∂t} + ×,  = ∇×,$$
$$∇· = ρ, ∇×\left({ \over μ} + ×\right) - {∂ \over ∂t} = .$$
Apart from the missing $×$ term, that's what Maxwell actually wrote. His $$ is equivalent to our $/ε$ or our $ + ×$, and his $$ should have been equivalent to our $/μ$ or $ - ×$, except for the absence of the last term. He actually did mull over whether that extra term should be included or not, at one point in his pre-treatise papers, but still kept it out.
The treatment given by Lorentz had a similar dichotomy and reduction in it.
Much later in the 20th century, completely oblivious to these, Levi-Leblond laid out in the literature his "Galilean limits", starting from the erroneous premise "what if Maxwell's theory had been Galilean", as if they weren't! He completely ignored all of this earlier work, because much of it was lost, forgotten or neglected by the mid 20th century.
Only the constitutive laws make any distinction between relativistic and non-Relativistic. To do this issue right, and tie into Levi-Leblond (and Bacry)'s later classification of "all possible kinematic groups", the following generalized form, further below, of the Maxwell-Minkowski relations can be posed.
The correct formulation of the so-called "Galilean limit" is in the larger framework that answers the question: what would electromagnetism and gauge theory look like in a universe whose kinematics are governed, locally, by one of the Bacry/Levi-Leblond kinematic groups?
There are 14 in their classifications. When the groups are centrally extended, this number reduces to 13. Overall, they comprise a 3-parameter family of kinematic groups. One of the parameters corresponds to the flatness and curvature of the underlying spacetime. 5 of the groups go with flat space-time geometry (the other 9 go with uniformly curved spacetime geometries). In 3 of the groups, the "time" in "space-time" is actually a spatial dimension ... so the original Bacry/Levi-Leblond treatment excluded them. That includes 1 of the 5 flat space groups. The reduction of 14 to 13 takes place with 2 of the flat-space groups (the Carroll and Static groups have the same central extension).
The 5 of the remaining flat space kinematic groups are: Poincaré, Galilei, Carroll/Static and Euclidean-4D. Their associated geometries have the following as their invariants
$$βdt^2 - α\left(dx^2 + dy^2 + dz^2\right),$$
$$β\left({∂ \over ∂x}^2 + {∂ \over ∂y}^2 + {∂ \over ∂z}^2\right) - α{∂ \over ∂t}^2,$$
$$dx·{∂ \over ∂x} + dy·{∂ \over ∂y} + dz·{∂ \over ∂z} + dt·{∂ \over ∂t}.$$
The parameter $α$ controls the Galilean limit: $c → ∞$ as $α → 0$. The parameter $β$ controls the Carrollean limit: $c → 0$ as $β → 0$. The "static" limit is also possible (that was the major innovation and point made by the Bacry/Levi-Leblond treatment), where $(α,β) → 0$, though the geometric representation given above ceases to be cohesive in the static limit. The Relativistic world corresponds to $αβ > 0$ with an invariant speed given by $c ≡ \sqrt{β/α}$. The timeless 4-D Euclidean space corresponds to $αβ < 0$.
The form of the constitutive law suitable for a universe governed by the $(α,β)$ version of the kinematic group is:
$$ + α× = ε( + β×),  - α× = μ( - β×),$$
with the non-relativistic version corresponding to $(α,β) = (0,1)$ and the relativistic case to $(α,β) = (1/c²,1)$.
A: The difference between Galilean and special relativity is the details of how spacetime coordinates change between reference frames. The Galilean transformation $t'=t,\,\mathbf{x}' =\mathbf{x}-t\mathbf{v}$ relates reference frames of relative velocity $\mathbf{v}$. This implies that, if $A$ has velocity $\mathbf{u}$ relative to $B$ and $B$ has velocity $\mathbf{v}$ relative to $C$, $A$ has velocity $\mathbf{u}+\mathbf{v}$ relative to $C$. This implies no speed can be invariant across reference systems. For example, if I shine a torch while on a train that's going past you, you and I should disagree on the speed of the torch's light.
However, Maxwell's theory contains waves of speed $c:=1/\sqrt{\mu_0\varepsilon_0}$, so cannot apply in all reference frames if they are related as per Galileo's formulae. In a region with no electric charges or currents, Maxwell's equations imply  the wave equations $$\nabla^2\mathbf{B}=c^{-2}\partial_t^2\mathbf{B},\,\nabla^2\mathbf{E}=c^{-2}\partial_t^2\mathbf{E}.$$
Special relativity still claims physical laws are the same in all reference frames, but they relate their coordinates differently, viz. $$t'=\frac{t-\mathbf{v}\cdot\mathbf{x}/c^2}{\sqrt{1-v^2/c^2}},\,\mathbf{x}' =\frac{\mathbf{x}-t\mathbf{v}}{\sqrt{1-v^2/c^2}}.$$One can show that a change in reference frames preserves the above  speed-$c$ wave equations.
A: From a mathematical point it is rather simple: Considering by $A^\mu$ the usual 4-vector potential and assuming the Lorenz gauge $ \partial_{\mu}A^\mu = 0$ the Maxwell equations of vacuum write as $\square A^{\mu} =\partial_{\nu}\partial^{\nu}A^{\mu} = 0$. However the D'Alembert operator $\partial_{\nu}\partial^{\nu} = \frac{1}{c^2}\partial_t^2 - \partial_x^2 -\partial_y^2 - \partial_z^2$ is invarariant under a linear transformation given by a matrix ${\Lambda^{\sigma}}_{\tau}$ if and only if ${\Lambda^{\sigma}}_{\mu}{\Lambda^{\tau}}_{\nu}g^{\mu\nu} = g^{\sigma\tau} = \mathrm{diag}(1,-1,-1,-1)$. These are precisely the Lorentz transformations. However, the Galilei transformations do not form a subgroup of these.
The basic idea of this approach is the idea that the physical laws (and therefore the corresponding differential operators) have to keep their form under valid frame transformations. But it is then postulated that (somehow vice versa) all transformations keeping the form (Lorentz-transformations, that is) are actually valid changes of reference frames.
A: 
My question is (1) how Maxwell's equations contradicted Galilean
  principle of relativity.

Maxwell's equations have wave solutions that propagate with speed $c = \frac{1}{\sqrt{\mu_0\epsilon_0}}$.
Since velocity is relative (speed c with respect to what?), it was initially thought that the what is an luminiferous aether in which electromagnetic waves propagated and which singled out a family of coordinate systems at rest with respect to the aether.
If so, then light should obey the Galilean velocity addition law.  That is, a lab with a non-zero speed relative to the luminiferous aether should find a directionally dependent speed of light.
However, the Michelson–Morley experiment (original and follow-ups) failed to detect such a directional dependence.  Some implications are
(1) there is no aether and electromagnetic waves propagate at an invariant speed.  This conflicts with Galilean relativity for which two observers in relative uniform motion will measure different speeds for the same electromagnetic wave.  This path leads to special relativity theory.
(2) there is an aether but it is undetectable.  This path leads to Lorentz aether theory.
A: Imagine a stationary electron sitting next to a long length of wire with current flowing through it. Since the wire is neutrally charged, there is no electric force on the electron, and since the electron is stationary, there is no magnetic force.
Now imagine the whole system is moving lengthwise at a constant velocity. All of a sudden the electron is moving through a magnetic field and experiences a force. This seems to be a contradiction.
In relativity, this will be answered by the differing length contractions of the positive (protons)/negative (electrons) parts of the wire, creating an electric force on the electron that balances the magnetic force. This also serves to show the difficulty of distinguishing electric from magnetic forces, as one may become the other in a different reference frame.
