If you want to experience what trains are like in Thailand, you can take a short trip on the Hua Hin to Cha Am train, visit the beach, then return by train, local bus or minibus / minivan from the main road.
This is really just an "experience trip" and not something we would recommend as the best way to travel from Hua Hin to Cha Am - The minivan and local bus are much more convenient.
The trip by train is only 20 to 25 minutes, but you'll get to see what life is like in 3rd class ordinary trains in the short space of time.
Be prepared for a delay - Ordinary trains are not famous for the punctuality in Thailand.
Ask at the ticket counter before you buy your tickets what time the train is expected.
Then if it is a long delay, you can abort your mission or walk down to the main road and take the local bus or minivan, then maybe try to take the train back from Cha Am.
Rap = Rapid train - Ord = Ordinary train
All these services operate daily.
Once you arrive at Ban Cha-am Railway Station, it's quite a long walk to the beach (around 2 Kilometres) so you may want to take a motorbike taxi (for around 30 Baht).
If you do want to walk, just head past the "Welcome to Cha Am" sign and carry on walking straight down the road (crossing the main road to Hua Hin on the way).
The beach is about 5 km long, with the nicest, widest parts to the north (the south part of the beach disappears at high tide).
3rd class seats on Ordinary trains cost just 6 Baht.
If you do want to take one of the really early morning Rapid trains to Cha-am, seats cost:
3rd class seats on Rapid trains cost 26 Baht.
2nd class seats on Rapid trains cost 33 Baht.