Kongevegen Filefjell goes between Lærdal in the west and Vang in the east. You can get there by public transport, both from Oslo and Bergen. If you want to visit Kongevegen for the first time, then take a couple of days to do two different through-hikes along Kongevegen. These two hikes will show you the best of what Kongevegen has to offer.
From Oslo take the NW161 bus leaving at 08:40 from the Oslo central bus terminal. This bus connects with NW162 and takes you to Kyrkjestølen where you will arrive at 14:11.
From Bergen, take the NW162 bus leaving at 09:10 and arrive at Kyrkjestølen at 13:16.
Both bus rides costs about 400 NOK per person.
From Kyrkjestølen hike to Maristova going across the Filefjell mountain. If you feel it is too late in the day to start hiking then consider staying a night at Kyrkjestølen and start the hike the next day instead.
Stay the night at Maristova when you are done hiking. Make sure to book well in advance. It is also possible to hike pass Maristova and continue 7-8 km towards Borlaug where you can stay at Borlaug Vandrerhjem.
From Maristova or Borlaug Vandrehjem you can take the local Kongevegbussen. It costs 100 NOK and leaves 1025 from Maristova and 1035 from Borlaug, reaching Borgund at 1050. Notice that the bus only operates from the end of June until mid-August. If you travel outside of the main season you will need to take a taxi. You can book a taxi through Solheim taxi at +47 415 10 100.
From Seltun at the end of the hike on day two, you can take the bus back to Oslo or Bergen. Going to Oslo you need to take NW162 to Fagernes and continue on NW161 towards Oslo. To Bergen, you can take NW162 directly to Bergen. Departure times depends a bit on the day of travel so you should check the timetables at Entur or NOR-WAY Bussekspress before you go.
If you get short on time you can also do only half the hike on day two and take the bus from Sjurhaugen instead.
Alternatively, you can also take the NW162 to Flåm. From Flåm you can take the famous Flåm Railway up to Myrdal. And from Myrdal take the regular train to Bergen or to Oslo. Use Entur to find the best options for travel as Entur covers most public transportation in Norway.