Here,
I see no reason not to say $f:\Omega\to \mathbb{R}$ instead of $f:\Omega\times\mathbb{R}^N\times\mathbb{R}^M\to \mathbb{R}$.
(Since $u(x)$ and $Du(x)$ are themselves functions of $x$, so should be $f$.)
where am I going wrong?
Here,
I see no reason not to say $f:\Omega\to \mathbb{R}$ instead of $f:\Omega\times\mathbb{R}^N\times\mathbb{R}^M\to \mathbb{R}$.
(Since $u(x)$ and $Du(x)$ are themselves functions of $x$, so should be $f$.)
where am I going wrong?
$f$ becomes a function of $x$ only when you substitute $u(x)$ and $Du(x)$ into it. Consider a simple example where $\Omega=\mathbb R$ and $N=M=1$. Then $u$ is just a real-valued function, as well as its derivative $Du=u'$. We can define $f: \mathbb R\times\mathbb R\times\mathbb R\rightarrow \mathbb R$ as e.g.
$$f(x,a,b) = x^2+2a - \exp(b)$$
This is a function of $3$ variables. When we substitute $f(x, u(x), u'(x))$, we get
$$f(x, u(x), u'(x)) = x^2+2u(x)-\exp(u'(x))$$
which becomes a function of $1$ variable. What matters is that the calculus of variations is concerned with the dependence of $f$ on $a$ and $b$ separately from dependence on $x$.