Depends on your preference & age of travellers. If you want to avoid long road journey, train is better and cheaper. You can take a train to Haldwani or Kadgodham & then take a taxi till Nainital.
Well it depends traveling by car is comfortable but costly, I advise to travel by train.
The nearest broad gauge railway station from Ghorakhal is Kathgodam which is at a distance of 35 Kilometers. There only three daily running trains from New Delhi to Kathgodam. 1. 12040/New Delhi – Kathgodam Shatabdi Express. Departs at 06:20 am from New Delhi and reaches Kathgodam at 11:40 am. 2. 15035/ Uttarakhand Sampark Kranti Express. Departs at 16:00 pm from Old Delhi and reaches Kathgodam at 22:45 pm. 3. 15013/Ranikhet Express. Departs at 22:05 pm from Old Delhi and reaches Kathgodam at 05:05 am.