In the following MWE:
\documentclass{book}
\newcounter{exnum}[subsection]
\begin{document}
\chapter*{Chapter}
\section*{Section 1}
\subsection{Subsection A}
\setcounter{exnum}{1}
Exnum is \theexnum.
\subsection{Subsection B}
Exnum is \theexnum.
\end{document}
I get the output I expected; namely, the line printed in Subsection A is Exnum is 1 and in Subsection B is Exnum is 0. However, in the actual code, I didn't want subsection numbers printed, so I changed both occurrences of \subsection to \subsection*. The output then consisted of Exnum is 1 in both subsections. As a workaround, starting from the code above, I instead added the line \setcounter{secnumdepth}{1} at the top, just after the documentclass, to prevent printing the subsection numbers, but left the \subsections unstarred. Again the output was Exnum is 1 in both subsections.
What is going on here? Are these two manifestations of the same failure, or are they different problems? And, what don't I understand about what secnumdepth does? I thought it simply prevented printing of section numbers, but clearly it does much more than that.