Connect to Database Engine Prompt on Script Object
I was able to reproduce the problem you're encountering.

Originally, I wasn't being prompted like you are being prompted.  There is a button just to the right of New Query that invokes the Database Engine Query.  This button would be very easy to click because it's close the the New Query button



This brings up the connection dialog box you are experiencing.  The problem is, once you click this button, you will continually be prompted for a connection until you exit out of SSMS and come back in (at least, that is how I corrected the problem).