Originally everyone had one kit. Then they started showing hockey on black and white TV's. The reds and blues looked the same on those TV's. So they had the road team wear an alternate white sweater.
back then on buses and with less advanced facilities the training staff had a hard time keeping the whites "white" on the road, where they didn't always have time to wash and bleach etc. and oft times didn't easy access to washing machines. So the league flipped it to home whites.
Nowadays with air flight and loaded facilites for the road team those impedements no longer exist. Fans overwhelmingly buy their teams' coloured kit over the white, so they switched it back.
IMO, in the modern HD colour TV era, the white sweater isn't needed. It should only be used when teams have too similar a colour scheme (Toronto/Tampa; Isles/Oilers,) etc.