The gold was for his kingship, the myrhh for his "priesthood" and the frankincence for his death. As the holy family had to flle to Egypt from Herod they could make good use of these gifts. Gold was/is valuable and could pay for food etc; myrhh could be used a bit like talcum for the baby and frankincence was used like a disinfectant.