How to determine whether a given transistor is NPN or PNP?
If you know the component is a BJT transistor, you can use a diode tester and test the pins pairwise.

If you find two diodes with a common anode, and no conduction between the two cathodes, then you have a NPN transistor.
If you find two diodes with a common cathode and no conduction between the two anodes, then you have a PNP transistor.

Other options, if you are not sure the component is a BJT:

If you find two diodes with a common anode, and some conduction between the two cathodes, the component may be a N-channel J-FET.
If you find two diodes with a common cathode, and some conduction between the two anodes, the component may be a P-channel J-FET.
If you find a single diode and no conduction with the third pin, the component may be a MOSFET.

But as others have written in comments, there are many other options for 3-pin packages, such as voltage regulators, SCRs, triacs, darlington assemblies, pairs of diodes, temperature sensors, “adjustable zener”, and probably many others…