Suppose that $f$ is an injection, and $A \subset X$. We always have $A \subset f^{-1}[f[A]]$, regardless of $f$, because $x \in f^{-1}[f[A]]$ iff $f(x) \in f[A]$ iff $\exists_{a \in A} f(a) = f(x)$, which obviously holds for $x \in A$ (as we can just take $a = x$), but for injective $f$ we can conclude more: suppose $f(x) = f(a)$ for some $a \in A$ (which is exactly what it means, by definition, for $x$ to be in $f^{-1}[f[A]]$), then by injectiveness, $x = a$, and so $x \in A$, and we have the other inclusion.
We always have $f[f^{-1}[B]] \subset B$: take $y \in f[f^{-1}[B]]$, which means that for some $x \in f^{-1}[B]$ we have $f(x) = y$. But $x \in f^{-1}[B]$ means that $f(x) \in B$ by definition, so $y \in B$.
Suppose that $f$ is surjective and $y \in B$. Then for some $x \in X$, $f(x) = y$ by surjectiveness. This $x$ is in $f^{-1}[B]$, as its image is $y$ which lies in $B$. So we know that $y \in f[f^{-1}[B]]$ by definition.