Proposition 2.24 on Liu Qing‘s AG book One of the conditions of this prop is $f:Y\longrightarrow X$ is a closed immersion. This makes $f(Y)$ is closed in $X$. Then we have   
$ (f_*\mathcal{O}_Y)_x = \begin{cases} 0, & \mbox{if }x \notin f(Y) \\ \mathcal{O}_Y,y, & \mbox{if }x=f(y) \in f(Y) \end{cases} $  
According to the definition of sheaf, subsets always be open. I don't know why $f(Y)$ should be closed in $X$, i.e, why $f:Y\longrightarrow X$ is a closed immersion makes the displayed equation hold.
 A: I'm answering the question you clarified in the comment, since the actual  question as written sounds different.
Let $x\in X$. If $x\not\in f(Y)$, since $f(Y)$ is closed, there's an open neighbourhood $U$ of $x$ in $X$, such that $f(Y)\cap U = \emptyset$. Now $f_* \mathcal{O}_Y(U)$ is by definition $\mathcal{O}_Y ( f^{-1}(U))=\mathcal{O}_Y (\emptyset)=0$. Since $(f_* \mathcal{O}_Y)_x$ is the inductive limit of $f_* \mathcal{O}_Y(U)$ over $U$ containing $x$, it is zero.
If $x\in f(Y)$, then every open neighbourhood $U$ of $x$ pulls back under $f$ to an open neighbourhood neighbourhood $V$ of the unique $y$ such that $f(x)=y$. Conversely, since $f$ is a closed immersion, the topology of $Y$ is identified via $f$ with the subspace topology on $f(Y)$ induced from $X$. That means every open subset $V$ of $y$ is of the form $f^{-1}(U)$ for some open neighbourhood $U$ of $x$ in $X$. Then 
$$ (f_* \mathcal{O}_Y)_x = \varinjlim_{x\in U} f_* \mathcal{O}_Y (U) = \varinjlim_{x\in U} \mathcal{O}_Y (f^{-1}(U)) = \varinjlim_{y\in V} \mathcal{O}_Y (V) = \mathcal{O}_{Y,y}$$
