When you say you need to do something, it is a task you cannot overlook. You have to do a particular task to survive the context.  ‘I need to go to the hospital’ ‘I need to go get my books back’ When you want to do something, you are usually saying it express your desire to do something. It could be a task that you can overlook. ‘I want to go shopping’ ‘I want to talk to her’