The shadow on the wall appears inverted because light travels in a straight line and the light rays cross each other as they pass through a small hole or slit, just as happens in a camera obscura.
Virupaksha Temple in Hampi, Karnataka.
Credit: Praveen Mohan