We do set default DB for logins other than master database in SQL server for security reasons. There is a scenario if default database gets offline or corrupts.
Suppose default database is XYZ that goes offline or corrupts then SQL does not allow connection to all logins those having XYZ as a default database. Because it tries to connect the default database first.
Thanks to SQLCMD that has a way to get in, using to -d switch
sqlcmd -S<servername> -d <Other_database_Name_ABC> -U<login> -P<password>