In Rudin's Real and Complex Analysis, the Lebesgue integral is defined as:
L et $(X,m,\mu)$ be a measure space, where $X$ is a set, $m$ is a $\sigma$ algebra on $X$ and $\mu$ is a measure. Then, if $f:X \to [0,\infty]$ and $E \in m$, we define $$\int_E f d\mu = \sup \int_E s d\mu \tag{1}$$ where the supremum is taken over all simple functions $s, 0 \leq s \leq f$
I do not have much background in measure theory, and I am wondering why we assume $f$ to be measurable to define its integral.
EVEN IF $f$ is not a measuarable function, the above definition (1) would still be well-defined.
Why do we define integral only for measurable $f$?
What you have there is the lower integral. There's also a similar upper integral. If they are equal, then the function is said to be integrable. So yes, your supremum is always defined, and that's a very good thing indeed. But it doesn't have nice sigma-additivity properties unless the upper and lower integrals are equal. That's why you need the integrability. There is a similar consideration for measures of sets, where there are inner measures and outer measures, and you get lots of nice properties if they are equal. Something similar also occurs with Riemann, Darboux and Stieltjes integrals.