Let's be clear: given a function $f\colon R\to S$, then $f$ induces two functions,
$$\begin{align*}
\underline{f}&\colon\mathcal{P}(R)\to\mathcal{P}(S)&&\text{the `direct image' function}\\
\overline{f}&\colon \mathcal{P}(S)\to\mathcal{P}(R)&&\text{the `inverse image' function}.
\end{align*}$$
These functions are defined by:
$$\underline{f}(X) = \{s\in S\mid\exists r\in X(f(r)=s)\}$$
and
$$\overline{f}(Y) = \{r\in R\mid f(r)\in Y\}.$$
We often just use $f$ to denote $\underline{f}$ and $f^{-1}$ to denote $\overline{f}$, but $f$ and $\underline{f}$ are different functions (and $\overline{f}$ is different from the inverse of $f$, when it exists).
But, let's be very careful and not conflate notations.
Note that in general it is false that if $y\in Y$, then necessarily $y\in \underline{f}(\overline{f}(Y))$. This holds if and only if $y\in \underline{f}(R)$; that is, if and only if $y$ is in the image of $f$.
So, take $X=\{x,\{x\},y\}$ (I will assume that all three elements are pairwise distinct), and let $f\colon\{a\}\to X$ be the function $f(a)=x$.
Now, let us compute $\underline{f}(\overline{f}(B))$:
$$\begin{align*}
\overline{f}(\{x,y\}) &= \{r\in A\mid f_1(r)\in\{x,y\}\}\\
&= \{r\in A\mid f_1(r)=x\text{ or }f_1(r)=y\}\\
&= \{a\}.\\
\underline{f}(\overline{f}(\{x,y\})) &= \underline{f_1}(\{a\})\\
&= \{f_1(a)\} = \{x\}.
\end{align*}$$
Note that $x\in \underline{f}(\overline{f}(B))$, exactly as desired.
It is also true that $\{x\}\subseteq \underline{f}(\overline{f}(B))$, and that $\{x\}$ is not in the image of $f$. But I don't see why this is a matter of concern: if we have $g\colon\{1\}\to\{2\}$ given by $g(1)=2$, then $\{2\}$ is a subset of $\underline{g}(\overline{g}(\{2\}))$ even though $\{2\}$ is not in the image of $g$ (it's not even in the codomain). So what?
You are conflating a lot of notation; for example, $f^{-1}(x)$ does not literally make sense: it should be $\overline{f}$, and the argument should be a subset of $B$, not an element; we often just write $f^{-1}(x)$, but that is sloppy notation that should be used only if there is no danger of ambiguity; but here, there is danger of ambiguity, because $f^{-1}(\{x\})$ could mean either $\overline{f}(\{x\})$, or $\overline{f}(\{\{x\}\})$. And when there is danger of ambiguity, we do not use sloppy notation that introduces the ambiguity.
So your argument should run as follows:
$x\in B$, so $\{x\}\subseteq B$. Therefore, $\overline{f}(\{x\})\subseteq \overline{f}(B)$. Hence, $\underline{f}(\overline{f}(\{x\}))\subseteq \underline{f}(\overline{f}(B))$.
And there is no problem: $\overline{f}(\{x\}) = \{a\}$, and $\underline{f}(\{a\}) = \{f(a)\} = \{x\}\subseteq \underline{f}(\overline{f}(B))$.
Why do you believe it should be $x$, though, is a mystery. Note that we do indeed have $x\in \{x\}=\underline{f}(\overline{f}(B))$, exactly as expected.
I think you'll find that your confusion arises from confusing the element $\{x\}$ of $T$ and the element $\{x\}$ of $\mathcal{P}(T)$ (that is, you are confusing them because in order to apply $\overline{f}$ to "the element $\{x\}$ of $T$" you actually have to compute
$$\overline{f}\Bigl(\bigl\{\;\{x\}\;\bigr\}\Bigr),$$
not $\overline{f}({x})$), and of confusing $f$ with $\underline{f}$. Try writing things carefully and without sloppy notation, and you'll see that the apparent contradictions disappear.