Like others have pointed out, the graph of both is not the same. There is a nontrivial singularity for the first function that is not present for the second.
A simpler version of your question seems to be:
Are the functions $f(x)=x$ and $f(x) = \frac{x^2}{x}$ the same?
The answer is, yes, except at the point $x=0.$ They are different because by default, mathematicians restrict the domain such that there can never be an input that requires division by zero. There isn't some mystical decree that states this should be the case, but it is generally assumed when a function has division by something that can be zero.