The easiest way to describe it is that it's happening everywhere with all light reflected off everything. But without a small hole to block out most of the "other" reflected/ direct light you don't see it because it's drowned out by everything else also going through the window against the wall. As for why it's upside down. It's simply a straight line between the object IRL and the pin hole and the wall where a point of the image shows up, same with a telescope.
On a more on topic point this happens with a bigger curtain rod hole i have near my bed allowing me to see a blurry (because the hole is bigger ) image of my lawn and other stuff for a nice green scene on my ceiling in the morning.