Often, if the part threads were cut on 2 different lathes, then the threads might be a slightly different pitch. If it's a CNC lathe then the feed speed is likely correct whereas a gear driven lathe may have a gear set that is an approximation of the pitch. It usually works out ok unless it's a long piece with threads. Then the slight mismatch will eventually catch up.
The fact that the tap didn't fit right is a solid indicator that the part threads are a slightly wrong pitch.
Or, most common, it could simply be that the thread depth on one or both parts doesn't match perfectly. Also common for the deeper threads on a female part to be cut more shallow deeper in. That small a part requires a small cutting tool that lends itself to flex. If the feed speed is too high the tool won't be able to keep up with the cut and will rise up and cut more shallow as it feeds deeper.