Pinhole images have been seen since the time of Aristotle. What he saw were images and shapes flickering through the tiny holes made between several overlapping leaves. Pinhole photography is the capturing of those images and shapes onto film without using a lens. A tiny hole replaces the lens.
Light passes through the hole and an image is formed on the back wall of the camera.
The image ends up being upside down because light travels in straight lines. Light traveling from above goes straight through the hole to the bottom of the camera wall and light traveling from below goes straight through the hole to the top of the camera wall. If looking at an outdoor scene, the image on the wall has the sky at the bottom and the ground at the top. Pinhole cameras can be small or large. They can be made of seashells, oatmeal boxes, film canisters, soda cans or any size box.