Upvote:5
You can do both in one day; they’re about 15km apart, and there’s a train that runs between Pompeii Scavi and Ercolano Scavi (Herculaneum) and takes about 30 minutes to span the distance between the two sites. It’s operated by Ente Autonomo Volturno S.R.L, runs about every 30 minutes, and is called Treni Turistici. Wth the Campania Artecard, the cost of the round trip is € 10 (usually € 15, see the notation at the bottom of the schedule link).
It would depend on your preferences, stamina, and season of the year which site to first visit when doing both in one day. Ercolano is smaller and more intact than Pompeii, usually less crowded, and easier to navigate. Pompeii is much larger, often very crowded and busy, and can be hot and exhausting with a huge amount of territory to cover. You could start at Pompeii early in the day (less hot, bit less busy, further from Naples), and make your way to Ercolano after lunch, where it shadier, and the architectural and archeological excavations a treat. As an estimate, you would want to allot at least 5 hours in Pompeii and 3 hours minimum in Ercolano.