The second one doesn't represent a function, because for some values of "x", you get two different values for "y" (which should not happen, if that were a function).
In every function, you must have a single "y" value for each "x" in the domain.
__________
In order to see it better, you can trace a vertical line onto that graph.
If that line and the graph intersects in more than one point, then that graph doesn't represent a funcion.
Look into the attached picture and see. That vertical red line and the graph intersects in two distinct points. Therefore, it can't represent a function.
Any doubt? Please, comment below.
I hope it helps. :-)