How come electrons in the d-subshell are considered valence electrons in transition metals?
The valence electrons are the ones responsible for engaging in chemistry and corresponds to the orbitals which are highest in energy. These electrons are the most easily accessed because they are not buried in the energy well of an atom. For main group elements, the highest principal quantum number p and s orbitals are the highest in energy, as you said, but for the transition metals, the partially filled d orbitals are the highest in energy. Generally, whichever orbitals are being filled last as you go across the periodic table are the ones that should be considered the valence electrons.

Another thing to note, as elements are ionized, the orbitals with higher orbital angular momentum drop in energy faster than orbitals with lower angular momentum. So, in the transition metals, the n d orbitals drop much more than the (n+1)s and p orbitals. Since, transition metals have &lt;10 electrons (the number it would take to fill up all the d orbitals), all of them reside in d orbitals (and none in the s and p) and so these are the highest occupied orbitals and therefore the ones that engage in chemistry.