If $f = g$ a.e. does not hold, then one of the sets
$$A_n := \{x \in X \mid f(x) \geq g(x) + 1/n\}$$
or
$$B_n := \{x \in X \mid g(x) \geq f(x) + 1/n\}$$
has positive measure (why?).
Now assume that $X$ is $\sigma$-finite (or semifinite, otherwise the statement is in general wrong).
Then there exists a subset $E \subset A_n$ or $E \subset B_n$ of positive, finite(!) measure (why?).
Conclude that $\int_E f \, d\mu \neq \int_E g \, d\mu$.
EDIT: As observed in the comments, it is not that easy to show that $\int_E f \,d\mu \neq \int_E g \, d\mu$ if one does not know that the two integrals are actually finite. But to ensure this, we can modify the sets $A_n,B_n$ to
$$
A_n ' = A_n \cap \{x \mid |f(x)|+|g(x)|\leq n\}
$$
(similar for $B_n '$) and then use the proof as described above.
You can do this going back to first principles.
Let $\phi$ be a simple function with $0 \le \phi \le f$ and let $E = \{f = g\}$. You can check that $\phi \chi_E$ is also a simple function and that $$\int \phi = \int \phi \chi_E.$$ Since $\phi \chi_E = 0$ whenever $f \not= g$ it follows that $0 \le \phi \chi_E \le g$. Consequently by the definition of the integral of $g$ you have
$$\int \phi \le \int g.$$ Take the supremum over all such $\phi$ to conclude by the definition of the integral of $f$ that
$$\int f \le \int g.$$
Now do it again, exchanging the roles of $f$ and $g$.
Best Answer
Let $E_n = \{x | f(x) > {1 \over n} \}$, then $E = \cup_n E_n = \{x | f(x) > 0 \}$.
Hence if $\mu (E) >0$ then there is some $n$ such that $\mu (E_n) >0$ and hence $\int f \ge \int f 1_{E_n} \ge {1 \over n} \mu (E_n) >0$, a contradiction.