(What is this function called, is it an exponential function?)
I plotted this function and found that only positive part of it is shown. Also while computing derivative of this function we take log which also implies that $x$ has been taken to have only positive values.
But I can take individual negative numbers and easily find its value like $(-2)^{-2}=1/4.$ (This is not true for negative fractions though) What causes this discrepancy?
There is more than one notion of exponentation; see this answer of mine.
The notion of exponentiation relevant to considering the function mapping $x$ to $x^x$ is the real, continuous exponentiation operation. It is only defined for positive bases (and depending on your conventions, also for a base of zero so long as the exponent is positive).
As an aside, a function isn't well-defined unless its domain and codomain is specified. The (presumed) intention here is that they should be inferred from context. The best inference here for the domain is the positive real numbers or nonnegative real numbers (since $x^x$ has a continuous extension to $x=0$).
When $x$ is a continuous, real variable, trying to consider $x^x$ defined for negative $x$ is extremely awkward, poorly behaved, and ambiguous, and furthermore I can only imagine extremely niche applications for it. You really shouldn't do so unless you have a crystal clear practical motivation making it necessary.