It is formed from the verb "yumayagpag," which means "to flourish, to prosper." The prefix "na-" in "namayagpag" indicates the past tense.
Therefore, namayagpag is the past tense of "yumayagpag" and literally means "was prosperous, flourished, was successful."