A lunatic is someone who is either clinically insane or just acting really crazy. Someone driving too fast and zigging in and out of traffic is driving like a lunatic.
The root of this word is luna, which means moon. That's because lunatic originally meant someone who went crazy with every phase of the moon, kind of like a werewolf. Most people these days don't believe in moon-caused insanity, but we still talk about lunatics, sometimes meaning clinically insane people. More often this is a slang term, used mainly in exaggerations, for anyone who seems wild and out of control.