SQL Server Express: difference between connecting to localhost and localhost\sqlexpress
Hypothesis one: You have installed a named instance called SQLExpress. This instance was configured to listen on the default SQL Server port 1433. Therefore wether you connect to 'localhost' or to 'localhost\SQLExpress', you are connecting to the same instance.

Hypothesis two: You have installed two different SQL Server instances, one named SQLExpress and one default, unnamed. Both connections succeed, but you are not connecting to the same instance.