What exactly does it mean for a scalar function to be Lorentz invariant?
It may look trivial, but that's what it is.
A Lorentz scalar is an element of the 0-dimensional vector space considered as a representation space of the trivial $(0,0)$ representation of the Lorentz group. In other words, a scalar $s$ transforms trivially:
$$s \rightarrow s' = s$$
A Lorentz vector is an element of the 4-dimensional vector space considered as a representation space of the standard $(\frac{1}{2}, \frac{1}{2})$ representation of the Lorentz group. In other words, a vector $\mathbf{v}$ transforms as:
$$\mathbf{v} \rightarrow \mathbf{v}' = \mathbf{\Lambda} \mathbf{v}$$
$\mathbf{\Lambda}$ is the Lorentz transformation matrix.
A scalar function, such as $\phi(\mathbf{x})$ maps a Lorentz vector to a Lorentz scalar, i.e. $$\mathbf{x} \mapsto \phi(\mathbf{x})$$
Consequently, it transforms to $$ \mathbf{\Lambda x} \mapsto \phi'(\mathbf{\Lambda x}) = \phi(\mathbf{x}) $$
Therefore, $$\phi' (\mathbf{x}) = \phi (\mathbf{\Lambda^{-1} x})$$ Indeed, $$\phi' (\mathbf{x'}) = \phi (\mathbf{\Lambda^{-1} \Lambda x}) = \phi (\mathbf{x})$$
You can also think of a scalar this way: it's a function $F$ that maps points of spacetime to numbers.
So, if $q$ is a point in spacetime, the representative of $F$ relative to a coordinate system $q \rightarrow x(p)$ is, say, $f$, defined by $f(x(q)) = F(q)$. If we have a second coordinate system $x' = \Lambda \cdot x$, then the representative of $F$ with respect to the new coordinate system is $f'(x'(q)) = F(q)$, so $f'(\Lambda \cdot x(q)) = f(x(q))$ or $f'\circ \Lambda = f$ or, finally, $f' = f \circ \Lambda^{-1}$.
The point is that while $F$ is independent of any coordinate system, its representatives w.r.t. different coordinate systems have to be related in this way since they're all tied to the same $F$.