We will show that if $(n-1)! \equiv -1 \pmod{n}$, and $n>1$, then $n$ is prime.
Let $a$ be any (positive) divisor of $n$ which is not equal to $n$. Then $a \le n-1$. So $a$ is one of the numbers which get multiplied together to form $(n-1)!$. It follows that $a$ divides $(n-1)!$.
Suppose now $(n-1)! \equiv -1\pmod{n}$. Then, by the definition of congruence modulo $n$, $n$ divides $(n-1)!+1$. But since $a$ divides $n$, the fact that $n$ divides $(n-1)!+1$ implies that $a$ divides $(n-1)!+1$.
But $a$ divides $(n-1)!$. Since $a$ divides both $(n-1)!+1$ and $(n-1)!$, it follows that $a$ divides the difference between these two numbers. But this difference is $1$. So $a$ divides $1$, and therefore $a=1$.
We have shown that if $a$ is any (positive) divisor of $n$ such that $a \ne n$, then $a$ must be equal to $1$. Since $n>1$, this forces $n$ to be prime, by the definition of prime. (The primes are precisely the numbers $n>1$ whose only positive divisors are $n$ and $1$. We have shown that if our congruence holds, and $a$ is a positive divisor of $n$ such that $a \ne n$, then $a=1$.)