There are a few options how to get to Machu Picchu, i.e., on foot, by bus or by train.
Hiking the Inca Trail is very popular, however, it actually may be quite crowded and other hiking routes are also possible.
Bus or train are good options as well; you can even combine them and then take a shorter hike; all depends on you, how much time you have, how fit you are or what season you’re traveling.
I chose the train (but it was 2011 – so I’m sure some things changed), because I had very little time, and March/April is not the best season in Peru for hiking.