In the Renaissance and later centuries the pinhole was mainly used for scientific purposes in astronomy and, fitted with a lens, as a drawing aid for artists and amateur painters.
Think in terms of ray tracing. Light travels in a straight line in a pinhole camera because there is no refracting or reflecting optical element to change the path of the rays of light. The bottom of the film is on the line passing through the pinhole and top of the object. Since all light must pass through the pinhole, that means the top of the object exposes the bottom of the film.