The connection between mass, environment, and slow rotation in simulated galaxies