Let $B$ be a subset of a set $A$. Let $f:B\rightarrow A, b\mapsto b$ be the inclusion map. I want to show $f$ is not surjective. And my attempt is:
Assume that $f:B\rightarrow A$ is surjective. Let $x_0\in A-B$. Then $f(x_1)=x_0$ for some $x_1\in B$. Thus $x_0=x_1\in B$, which is contradicting to the fact that $x_0\in A-B$. Hence, $f:B\rightarrow A$ is not surjective.
But my professor said my proof is wrong and I didn't understand the definition of surjectivity and its negation. Can anyone help me? Thank you in advance!
There doesn't appear to be any deep problem with your proof, except that you seem to be assuming that $B$ is a proper subset of $A$ rather than just a subset. Otherwise you have no reason to think $A\setminus B$ contains any $x_0$ you can choose.
But that is at most a misunderstanding of "subset", not one about surjectivity and/or its negation.
And taking your goal literally, it is not necessarily true: $A=B=\{1,2,3\}$ is a counterexample.