Question
Let $\mathcal{B}$ be the entire Borel set of $\mathbb{R}$. And let $\chi_E$ be the indicator function of the set $E$.
$(X, m, \mu)$; measure space, map $f: X \to \mathbb{R}$; measurable.
For $A \in \mathcal{B}$, we define $$ \lambda(A) = \mu(f^{-1}(A)). $$
When $g = \chi_E$, $E \in \mathcal{B}$, the following equation transformation holds: $$ \int_{\mathbb{R}} \chi_E\ d\lambda = \lambda(E) = \mu(f^{-1}(E)) \overset{?}{=} \int_{X} \chi_E \circ f\ d\mu. $$
Why is the third equal sign valid?
What I know
$\chi_E \circ f = \chi_E(f)$,
$\int_{X} \chi_E \circ f\ d\mu = \mu((\chi_E \circ f) \cap X)$.
$\chi_E \circ f$ is not exactly $\chi_E(f)$, as the input set of $\chi_E$ is $\mathbb{R}$. Moreover, your formula $\int_{X} \chi_E \circ f\ d\mu = \mu((\chi_E \circ f) \cap X)$ doesn't make sense as $(\chi_E \circ f) \cap X$ is not a set as $(\chi_E \circ f)$ is a function and not a set.
More precisely, $\chi_E \circ f$ is a function from $\mathbb{R}$ to $\mathbb{R}$ defined by
$$\forall x \in \mathbb{R}, \quad (\chi_E \circ f) (x) = \chi_E(f(x)).$$
Therefore we can see that $(\chi_E \circ f)= \chi_{f^{-1}(E)}$. Indeed, for $x \in \mathbb{R}$, $$\begin{array}{lll} (\chi_E \circ f) (x) &=& \chi_E(f(x)) \\ &=& \left\{\begin{array}{lll}1 &\text{si }f(x) \in E \\ 0 &\text{otherwise} \end{array} \right. \\ &=& \left\{\begin{array}{lll}1 &\text{si }x \in f^{-1}(E) \\ 0 &\text{otherwise} \end{array} \right. \\ &=& \chi_{f^{-1}(E)}(x) \end{array}$$
Therefore we get $$\mu(f^{-1}(E)) = \displaystyle\int_X \chi_{f^{-1}(E)} d\mu = \displaystyle\int_X \chi_E \circ f d\mu.$$