Why does my motor turn on with this sketch?

Without a schematic, you aren't going to get any meaningful help. Show us how your switch(s) is(are) wired. You speak of am on/off switch, but your code shows either two switches being checked, or some sort of arrangement of your switch that affects two different pins.