With a function, it works this way: you put in a number, do the math and out comes another number.
With 2^x it is just like this. The reverse is also true: if you have some number that is the outcome of 2^x, there is always just one x with which you started.
E.g: 2^3=8. If you work back from 8 you only get 2.
With x^2 it is just a little different: you put in 2, out comes 4. No problem.
But if 4 is an outcome, you have to choose between two numbers: it could that you put in 2, but it also could have been -2: (-2)^2 =4.
x^2 has no inverse, because you do not have a unique origin of a number.
Compare this with 2^x...