You could go by train from Cardiff to Newport and then Stagecoach Gold X24 bus service to Blaenavon and then a local bus over to Big Pit = bus 31 operated by Phil Anslow. This is all a bit of a faff and even though Big Pit is very good and you really go underground, you might like to consider my suggestion below. Big Pit has free entry. The alternative is to go by train to Cwmbran and then bus.
https://www.rctcbc.gov.uk/EN/Tourism/RhonddaHeritagePark/Home.aspx - you don’t really go underground but they try and give you an experience as if you are going underground. This place is easily reached by local trains from Cardiff in 35 minutes to Trehafod station (Treherbert line) and the train is £7.90 return. Trains are every 30 minutes - which will increase to 15 minutes once the new electric service starts. From Trehafod station you go through a walkway under a road and turn right on meeting a road with houses. Walk for about 10 minutes along a relatively quiet road and you come to the Rhondda Heritage Park mining experience. You pay for this place.