Why isn't what I have written a bijection?
Because what you have written is not a function, to begin with. More precisely, because there is no guarantee that the string of characters you wrote defines anything.
Recall how a function is often defined. One fixes some sets $X$ and $Y$ and one decides that, for each $x$ in $X$, $f(x)=[\text{some complicated formula involving}\ x]$. Then $f$ is well defined, provided that, for each $x$ in $X$, $[\text{some complicated formula involving}\ x]$ is indeed an element of $Y$.
But one never decides that $f:[\text{some complicated formula involving}\ x]\mapsto x$. Why? First thing is that it could happen that $z=[\text{some complicated formula involving}\ x]$ and also $z=[\text{some complicated formula involving}\ x']$ for some $z$ in $X$ and some $x$ and $x'$ in $Y$ with $x\ne x'$. Then what would be $f(z)$? One should have $f(z)=x$ and $f(z)=x'$. But $x\ne x'$, hence this is impossible.
Example: The function $h:[0,2\pi]\to[-1,1]$, $x\mapsto\cos x$, is well defined but the object $f:[-1,1]\to[0,2\pi]$, $\cos x\mapsto x$, does not exist. For example, $\cos(\pi/2)=\cos(3\pi/2)=0$, hence one should choose at the same time $f(0)=\pi/2$ and $f(0)=3\pi/2$.
In your case, to assert that there exists something like $f:B\to\mathbb N$, $n/(n^2+1)\mapsto n$, is to assume from the start that indeed $n/(n^2+1)\ne m/(m^2+1)$ for every $n\ne m$ in $\mathbb N$, that is, roughly the result you are asked to prove. (Thus, the grade is correct but the explanation for it is not.)