To get to Barry by car from Cardiff, take the A4232 and follow the signs for Barry. It should take about 25 minutes depending on traffic. If you're coming from Swansea, take the M4 eastbound until junction 33, then follow the A4232 to Barry.
Alternatively, you can take the train to Barry from Cardiff Central station. Trains run regularly throughout the day and take about 25 minutes. From Swansea, change at Cardiff Central and take a connecting train to Barry. From London, take a train to Cardiff and then change for Barry.
If you're already in Barry and want to explore the local area, consider visiting nearby Penarth or the seaside town of Barry Island. Both are easily accessible by train or car.