Let $(X_1, \mathcal{A}_1)$ and $(X_2, \mathcal{A}_2)$ be measurable spaces. Given a map $f\colon X_1\longrightarrow X_2$ we say that $f$ is measurable if $f^{-1}(V)$ is a measurable set in $X_1$ for every open set $V$ in $X_2$.
In Rudin's "Real and Complex Analysis, 3rd ed." the above definition is enlarged: We say that $f$ defined on a set $E\in \mathcal{A_1}$ is measurable on $X_1$ if $\mu(E^c)=0$ and if $f^{-1}(V)\cap E$ is measurable for every open set $V$.
While I understand, that the secon definition is a real extension of the first, I don't understand what he writes next.
"If we define $f(x)=0$ for $x\in E^c$, we obtain a measurable funciton on $X$, in the old sense" (Old sense = first definition). He then adds "If our measure happens to be complete, we can define $f$ on $E^c$ in a perfectly arbitrary manner, and we still get a measurable function"
I cannot see why defining $f(x)=0, \ x\in E^c$ leads to the first defintion.
First of all, presumably you mean for $X_2$ to be $\mathbb{R}$ (or $\mathbb{C}$) and for $\mathcal{A}_2$ to be the Borel $\sigma$-algebra. Otherwise it does not make sense to talk about open sets or to define $f(x)=0$.
Now, if you extend $f$ by defining $f(x)=0$ for $x\in E^c$, it becomes defined on all of $X_1$. Moreover, for any open set $V$, $f^{-1}(V)=f^{-1}(V)\cap E$ if $0\not\in V$ and $f^{-1}(V)=(f^{-1}(V)\cap E)\cup E^c$ if $0\in V$. Either way, $f^{-1}(V)$ is measurable. Thus this extended version of $f$ satisfies the first definition of measurability.