We can easily prevent this from happening automatically. Simply follow the steps as given below:
1. Open Control Panel.
2. Click on Ease of Access.
3. Click on Ease of Access Center.
4. Click on Make the keyboard easier to use.
5. Now Check the check box “Prevent windows from being automatically arranged when moved to the edge of the screen”.
OR Simply type “%systemroot%\system32\control.exe /name Microsoft.EaseOfAccessCenter /page pageKeyboardEasierToUse” in “Start Search” or “Run” dialog box to open following Window.
Now Windows will not get automatically arranged, you can easily revert to default by unchecking the check box.