The simulator is just an algorithm. The idea is that for any adversary $A$, you can create an algorithm $S$ that can "simulate" $A$, that is, that has the same output as $A$.
The notation $S^{f}$ means that the algorithm $S$ does not have direct access to $f$, but just oracle access, i.e., every time $S$ wants to evaluate $f$ at an input $x$, it just sends $x$ to the oracle and gets $f(x)$. This formalizes the notion of "$S$ learns nothing about $f$ but pairs of input-output $(x, f(x))$".
The actual input of $S$ is just the "size of the program". That is why we write $S^f(|f|)$.
On the other side, we have an adversary (also an algorithm) that has as input an obfuscation of the function, i.e., $O(f)$, and can evaluate the obfuscated function by itself, obtaining $O(f)(x) = f(x)$ for any $x$. But more than that, it can actually analyze $O(f)$ to try to extract extra information about $f$.
Now, when we say that these two probability distributions are the same (or are indistinguishable), we are saying that both $S^f$ and $A$ behave in the same manner, i.e., the values output by them are the same. In particular, if $A$ can output some information about $f$, so can $S^f$. But then that information can be learned from the input-output pairs, since that is all that $S^f$ has, which means that the obfuscation $O(f)$ is not leaking extra information about $f$, as intended.