Arriving by plane
Bristol Airport. This is the closest airport to Bath. The easiest way to go from Bristol Airport to Bath is to take the direct A4 bus (which runs approximately once per hour with journey time of just above one hour). A slightly faster way is to take the Airport Flyer bus to Bristol Temple Meads train station and then take a train to Bath (the overall journey time is approximately 50min).
London Heathrow. There are trains going from Heathrow airport to Bath, but this is usually an expensive option. Alternatively, you can take a direct bus from Heathrow Central Bus Station to Bath (journey time of approximately 2.5 hours) or (perhaps the favorite choice for locals) take the RailAir bus from Heathrow to Reading train station and then take a train from Reading to Bath (overall journey time of about 2 hours).
London Gatwick and Birmingham International airports are further away but could be an alternative. From them, you can take a train to Bath (approximate journey time of 3 hours from Gatwick and 2.5 hours from Birmingham).
Arriving by train
The main train station in Bath is Bath SPA.
Information regarding the trains can be found at http://www.nationalrail.co.uk
Getting to campus
The University of Bath is on the top of a hill. The bus lines 18 and 18U can take you from the city center to campus; you can purchase the ticket directly on the bus.
Walking from the city center to the university is possible, but it includes a long and steep hill and takes around 45min. The other direction (from the university to the city center) is a rather pleasant and scenic walk when the weather is nice.
Further information, including campus maps, can be found in the university website.