Controlling motor speed with PWM; Chapter 4 in Jeremy Blum - Exploring Arduino

Not familiar with this example ....Could be a power supply problem - not enough to supply everything . Run the motor off the battery and the Arduino from the USB .The transistor getting hot is an indication it is not fully switching - have you got it the right way around ?

Are you running the identical circuit as per the example ? You also must have the code loaded and be using the same board

Also a motor may not operate at the lower voltage .