It occurs because the same emitted energy spreads over the surface of an expanding sphere, whose area is (4\pi r^2). It applies approximately to light and radiation from a small point source, gravity, and electrostatic force.
This overview explains the geometric basis.