Nan means “what” and is used before such sounds as D(ex. Koreha NAN desuka?), N(ex. Kore ha NAN no hon desuka?) and T(NANto!!=showing that you are surprised). Nan also means “How many” if it is used with a counter. (ex. Nan nin =How many people?, Nihongo ha nannen benkyou shiteimasuka?= How many years have you been studied Japanese?)
Nani means “what” as well.
Ex. Kore ha Nani iro desuka? =what color is this?
Anata ha nani wo shiteimasuka?= what are you doing?
※There are some exceptions. For example, 何回生?(Nankaisei)=What is your grade at the university? Kyou ha NANyoubi desuka?=what day is it today?
-In such cases, it may be easier to pronounce NAN than Nani.
Good luck! Ganbattekudasai ^^*