BOSTON—Massachusetts may soon have a new law broadly allowing people to use restrooms and locker rooms that match their gender identity, marking a likely victory for transgender advocates after North Carolina passed a law requiring people to use the public bathrooms that correspond to the gender on their birth certificate.

The Massachusetts legislation would expand existing state law prohibiting discrimination to include gender identity in public accommodations like restaurants, malls and sports arenas.

...