Because you're invoking undefined behavior. Anything can happen when you do what you did.
A bit more elaboration: Variables defined within the local scope without being `static' reside in an area, that the C specification only vaguely calls "automatic memory". As soon as the scope of the function is left, all the contents in the automatic memory of that function invocation are no longer defined. To make this clear: Automatic memory is not associated with the function it's associated with a specific call of the function.
The practical method in which automatic memory allocation/deallocation is done is implementation-defined. But there is a de-facto standard way to implement automatic memory, which is called stack frames.
The stack is a designated ares of memory where with each function call another chunk of that memory area on top of the existing stack is allocated for the scope of the function call. So for each function call in the chain of function calls in the program another hunk of automatic memory area is put on top of the previously allocated areas, i.e. it forms a stack of automatic memory areas. When a function scope is left – and that can happen only for the last function in the chain of function calls – the whereabouts of the associated stack frame are simply discarded. But the contents of what got stored there are not destroyed in the usual implementations. Which means, that, as long as no other function got called you will find the junk left behind, if you know where to look.
So in a stack frame based implementation, that does no cleanup on scope exit, taking the address of a variable in automatic memory and passing it up to higher scopes does just that and may present you with contents of a no longer valid scope. But implementations may as validly choose to mark the unused parts of stack memory as invalid with the OS and trying to access it may crash the program as well.