The word mantra comes from two roots in Sanskrit: man, trai. "Man" means "to think", and "trai" means "to protect or free from the bondage of samsara or the phenomenal". So put simply, mantra means "the thought that liberates and protects".
Mantras are not man made, some were seen by ancient Rishis (Indian Seers who wrote the Vedas), and some were conveyed by visions or deities to highly realized spiritual masters.
Many mantras have been repeated millions, or even billions of times in the past. They derive their power from people chanting them in the past, present, and future, and by the deities and meanings associated with them. They are ultimately seen as being timeless.
Mantras connect us to the "spiritual reality" through our speech, and they are like bridges for our consciousness. In fact, in Buddhism and Hinduism when one purifies their speech, all of their speech is seen as mantra. Mantras represent powerful modes of consciousness, conveyed through human speech.