It's IMHO p-hacking. Why? By focusing solely on the data from males and disregarding the data from females, the researcher is engaging in a form of cherry-picking, which can lead to biased results and conclusions. This behavior increases the chances of finding a statistically significant result by chance alone (especially if multiple comparisons or tests are conducted).
The practice described in the scenario is not an instance of 'the garden of forking paths'. The garden of forking paths refers to a situation where researchers explore multiple hypotheses, analysis paths, or data subsets, and then selectively report the results that support their preferred hypothesis or direction of the effect. In this case the researcher has not explored multiple alternative hypotheses or analysis paths before settling on the one that supports their initial hypothesis. Instead, the researcher has formed a specific hypothesis based on their observation of the data and the theoretical reasons they can think of, and then tested that hypothesis using a single statistical test.
Did no one else think this was a homework question? E.g., in this sentence...
Imagine you join a new research lab and are immediately assigned a dataset that contains the same variables as those in the substance abuse dataset but comprising a new sample.
...it seemed to me that the "substance abuse dataset" must have been described in the previous homework question. YMMV. ;-)
PS- Regarding the names for all of these bad practices, I like this comment from Andrade (2021):
The QRPs discussed in this article are not necessarily defined and explained in the same way in all articles on the subject. This is because there is some overlap in concepts across some of the QRPs. What’s important, therefore, is for readers to understand the principles involved.