New light switch not working
The whites aren't hot, they're neutral

The white wires here are not hot wires at all, they're the neutral wires that return current back to the power company.  So:


Blacks go to switch terminals (one is the always-hot, the other the switched-hot to the light)
Whites get nutted together to provide a neutral return to the panel/power company service
Grounds get nutted to each other and to a bare pigtail going to the switch's green ground screw.