Because open windows are an invitation for thieves. The Germans argue quite sensibly that you have an obligation to your fellow man to keep crime down.
What the hell? So are home alarms (with prominently displayed window stickers) mandatory by law?
What if I leave my cell phone out on the table while I'm eating at a restaurant? By-law infraction?
If you leave your windows open and aren't there then people can easily steal from you and then cost the public money. Nobody was penalised, simply contacted and asked to close the window on their car.
You have been breaking the law before they contact you. They are just sometimes nice like that. In contrast to the
If you want to know the specific part of the traffic law: StVO ยง 14, 2 (safety when entering and exiting the vehicle) [http://dejure.org/gesetze/StVO/14.html]:
"Kraftfahrzeuge sind auch gegen unbefugte Benutzung zu sichern."
(Vehicles are to be protected against unauthorized use.)
Also, your insurance might not like this ;).
As I said before, the german law is much more build around responsibilities. This is one example.