莫名其妙is an adjective. And it means you cannot understand the things that happened.
for example,
你這人真是莫名其妙。 You are so 莫名其妙。(You cannot be understood.You may think that there's something wrong in the person's mind.)
這到底怎麼回事啊,莫名其妙。(what's going on? i cannot figure it out.)
你怎麼莫名奇妙地就和他結婚了呢? Why you suddenly get married with him.i don't understand.