The actual switch (in humans and I believe most mammals) is a gene called SRY. The Y chromosome is just the (usual) container for the switch.