I think direct injection allows engines to run higher compression ratios without knocking. I'm not sure exactly why, but I assume it's because the fuel sprays directly on top of the piston which could allow it to cool any hot spots which would have normally caused detonation.
The fuel probably has to fully vaporize before it can ignite. This happens in the manifold for a normal EFI, or in the carburetor for an older engine. There's some short period of time that this is happening, and so if you time the injection to happen with enough time to vaporize the fuel before ignition it probably doesn't have enough time to pre-ignite before spark.