For simplicity let's adopt the notion that is limit is the value that the function approaches as x approach a number. There is a more crisp definition but this suffices for our purposes.
So even though f(5) is -3 by the definition above that doesn't matter. The limit doesn't have to be -3 if it isn't continuous.
Now I'm gonna plug in 5 into the expression -(x^2)-1 even though the function isn't defined at 5.
-(5^2)-1 = -26 which is not equal to -3
Since -(x^2)-1 is continuous, we can conclude that the graph of the piecewise function is smooth most of the way but jumps up at x=5 and then conforms back to the original behavior.
So the limit is just -26 because all we care about is the behavior that exists near x=5.