A mantra is something that protects the mind from itself, really, by giving it some fodder other than the thinking process.
The word “mantra” means “mind-protecting.”
There are many, many types of mantra. Most spiritual traditions have them. There are power mantras. There are seed mantras, like “Om,” that express some essential vibratory quality of the universe. There are mantras to activate each chakra in your body.
When I was studying with Hari Dass in India, I learned mantras for every single activity I engaged in every day. I learned mantras for waking up and mantras for going to sleep. I learned a mantra for taking a shower. I learned mantras for going to the toilet – for each type of going to the toilet. I learned mantras for everything. And the purpose of the mantras was to keep reminding me to turn it all into a sacrifice, an offering.
Swami Muktananda used to tell a story about a saint who once was giving a discourse on mantra. A man in his audience stood up and said, “What is this nonsense about mantra? Who wants to waste time repeating the same word over and over again. Do you think if you chant ‘bread, bread, bread’ it will fill your belly?” The saint jumped up from his seat. He pointed his finger at the man, and shouted, “Shut up and sit down, you stupid ass!” Well, the man was furious. He got red in the face, and his whole body started shaking with rage. He sputtered, “You call yourself a holy man, and you use a foul term like that in talking to me?” The saint said very mildly, “But, sir, I don’t understand. You heard yourself called an ass just once, and look how it’s affected you. Yet you think that our repeating the Lord’s name over and over again for hours won’t benefit us.”
– Excerpt from Paths to God: Living the Bhagavad Gita, by Ram Dass