Machu Picchu itself is only around 2400 metres above sea level - well below the altitude that most people would suffer any real effects of altitude sickness, and about 1000 metres lower than Cuzco (3400 metres) where most people visit before heading to Machu Picchu.
If you are planning to trek then it really depends on which path you take.
The "Inca Trail" (specifically the path from KM88 to Machu Picchu which is what most people take) is ~ 42km, and reaches altitudes up to 4200 metres at which point most people will at least have some difficultly with the thin air, especially when going up-hill (You'll never look at a single flight of ~20 stairs the same way again!). ~40km ~38km over the first 3 days is going to be difficult for most 5 years old, even without the altitude. (The 4th day is the last ~4 km, and mostly downhill so less of an issue)
There are other options of varying difficulty and altitudes. Some of these do go higher than the Inca Trail (eg, Lares gets up to over 4500 metres), although all will only stay at those altitudes for short periods of time, before dropping back to lower altitudes to sleep. Without knowing what distances you're looking for it's hard to make a recommendation on what might me suitable.
An additional option is to take the bus to Machu Picchu (train from Cuzco to Aguas Calientes where you can stay the night and catch the bus early the next morning). You can still reach Machu Picchu around/before sun rise, and do a day hike up Huayna Picchu - the peak you often see "behind" Machu Picchu in photos.
If you are heading to higher altitudes then generally a day or two in Cuzco will give you suitable time to acclimatize. Cuzco itself is an amazing place, and even ignoring the need to acclimatize I'd suggest spending at least 2 days there to see the city itself and the surrounding areas.