The reason is that for a long period of time, there are unwritten rules in the league where home teams wear light-colored jerseys and away teams wear dark-colored teams.
Because the visiting team did not have laundry equipment in the early days of the league, they wore darker jerseys to cover up the stains on the jerseys.