Some programs (such as computer games in particular) change the screen resolution when you run them. When it happens, Windows automatically re-arranges the desktop icons to fit the new screen size. When you exit the game, the screen resolution may change back, but the icons have already been re-arranged.