I am learning set theory based on Pinter textbook. In the textbook, the author suggests that the axiom of replacement implies the axiom of pairing and the axiom of subset. I was trying to deduce the axiom of subset based on the axiom of replacement and some other axioms. But I noticed that I don't even need the axiom of replacement to do it. This is my claim. For any set, the axiom of power set guarantees the existence of power set. Then, for a subset of the set, the subset is a member of the power set, so it is a set, due to the definition of set.
If this is true, why do we even need the axiom of power set? What is wrong? And how should I properly deduce the axiom of subset from the axiom of replacement?
The power set axiom tells you that when $X$ exists, then a $\mathcal P(X)$ also exists, with the property that everything that exists and is a subset of $X$ is an element of $\mathcal P(X)$.
It doesn't guarantee that any particular subsets exist, only that whenever you find something in your model that is a subset of $X$, it will be in $\mathcal P(X)$.
For example, in a countable model of set theory (which has to exist due to Skolem-Löwenheim), not all the subsets of the model's natural numbers will actually exist as sets in the model, but some of them will -- and what the model considers to be $\mathcal P(\mathbb N)$ will consist of those and only those.
To prove that $\{x\in X\mid \phi(x)\}$ exists as a set, divide into cases depending on whether anything in $X$ satisfies $\phi$. If not, then you're looking for the empty set, which you should already know exists. Otherwise choose some $y\in X$ such that $\phi(y)$ and consider the range of $$ F(x) = \begin{cases} x &\text{if }\phi(x) \\ y &\text{otherwise} \end{cases} $$