You have the option of several different Vietnam National Railways services from Ho Chi Minh City to Nha Trang everyday on SE2, SE6, SE8, SNT2.
The morning trains from Ho Chi Minh City to Nha Trang depart at 6am ( SE8), and 9am (SE6) and get to Nha Trang seven and a half hours later. These are followed by 11.55am and 1pm departures which take you from Ho Chi Minh City to Nha Trang by 8pm and 9.30pm the same evening.
Vietnam Railways has two overnight trains departing Ho Chi Minh City at 20.30pm (SNT2) and 10.00pm(SE2) and arriving in Nha Trang early the next morning (VND640.000/USD30 for a berth in an AC second class sleeping car). With all overnight trains from Ho Chi Minh City to Nha Trang it is advisable to inform your hotel of your arrival time to ensure everything is ready when you get in as the usual check-in hour is after midday but with a prior notice you may sometimes get a room earlier.