Why does the electric field and not the magnetic field remains in the same direction after reflection from a medium? I was reading up about reflection and transmission when an electromagnetic wave is normally incident on a surface.
I came across this figure :

My question is why is the direction of electric field same while the magnetic field's direction is inverted , can't it be vice versa?
 A: It  is a figure for polarized waves, the convention is that the electric field is used to define the polarisation state. The change in the magnetic field direction is the effect in three dimensional space of the reflection, by construction of the polarization state.
Think of a shape you see on an incoming  ball which hits and reflects towards you  from a wall. The shape will be behind the ball after reflection and you will not see it. 
One could interchange the role of E and B in the convention of the figure, and then it would be the E field that would reflect.
A: For a plane wave $\frac{\omega}{c^2} \vec E = \vec k \times \vec B$. This is due to, equivalently, Ampères law, Maxwell-Faraday's law and the fact that $F^{\mu\nu} = \partial^\mu A^\nu - \partial^\nu A^\mu$, in covariant notation using the four potential. For the reflected wave the direction of $\vec k$ is reversed, so one of $\vec E$ and $\vec B$ must be reversed. The direction of $\vec E$ is maintained as a minus sign would imply a 180 degrees phase change.
A: Actually the direction of the electric field may change if the reflection coefficient is $<1$ but the key point is that the $z$-component of the reflected $\vec k$ changes, and the direction of $\vec B$ is related to the direction of $\vec E$ by a cross product with $\vec k$:
$$
\vec B\sim \vec E\times \vec k \times (\hbox{some scalar factor})
$$
so the change upon reflection of the $z$-component of $\vec k$ necessarily induces a change in the relative orientation of one component of the reflected $\vec B$.
Note that, in your figure, the transmitted $\vec B$ is in the same direction as the incident $\vec B$ since there is no change in the direction of the $z$-component of $\vec k$ upon transmission, just a change in the length of this component.
A: Yes it can. It just depends on what convention or meaning you adopt for the reflection coefficient.
Assuming $n_2 > n_1$, then the arrangement as drawn results in a negative reflection coefficient. i.e. The reflected electric field is actually in the opposite direction to that drawn. However, the E-field and B-field directions are not independent; their vector product should be in the (fixed) propagation direction for the reflected ray. So if the E-field direction reverses, then so does the B-field.
If $n_2 > n_1$ and you start with a diagram that has both the reflected E-field and B-field reversed to that shown in your picture (both must be reversed to be consistent with the wave propagation direction), then all that happens is you get a positive reflection coefficient.
