Ninfa has extremely limited opening times, unless you are booking ahead for a large group. Standard opening is the first weekend and third Sunday of each month (April to October). The gardens close for a couple of hours at lunchtime. Individual travellers may be able to buy tickets on the spot, but as limited numbers are admitted, you should really book in advance to guarantee entrance.
If you are visiting Ninfa by public transport, the best method is to take a train to Latina (half an hour from Rome). The station (which is actually at Latina Scalo, 9km from Latina itself) is the closest to Ninfa. Infrequent local bus services will take you a little nearer your destination, but the simplest method is to take a taxi.