In a country well-served by railways Gubbio is unusual in that the closest station, on the Rome-Ancona line, is 18km away at Fossato di Vico station. There is a bus service from there. An alternative is to take the train to Perugia and take a bus from there (40km).
If coming from the north coast (e.g. if you were driving down the coast from Venice) leave the A14 Autostrada at Fano.
From the north on the A1 Autostrada, exit at Arezzo. From Rome and the south exit the A1 at Orte and follow signs to Perugia and then to Gubbio.
The airport at Perugia  has flights from Milan and London Stansted.
Within the walls, traffic is restricted, so be prepared to walk, if you are physically able.