Swansea is one of the final destinations of the Heart of Wales Line, a train going through the center of Wales from Swansea to Shrewsbury. I wrote about it on my Brecon Beacons page, so I just want to say here: If you have any chance to use this train, even for a short part only, do it. This train ride was one of the highlights of my trip to Southern Wales.
Trains to Swansea leave from Paddington Station in London.They are fairly regular and the journey takes about 3 hours.
It is always wise to book a seat 24 hours in advance.
Travel by road from London is on the M4, and again takes about 3 hours if the traffic is light.