He won the case, didn't he!
Seriously though, there is an arguable reason for hiring him. In the script, before Moranis comments on their mistake:
JUDGE: I want to make one thing very clear before we go any
further. The law does not recognize the existence of ghosts, and I don't believe in them either, so I don't want to hear a lot of malarkey about goblins and spooks and demons. We're going to stick to the facts in this case and save the ghost stories for the kiddies. Understood?
DEFENSE TABLE. Stantz leans over and whispers to Spengler.
STANTZ: Seems like a pretty open-minded guy, huh?
SPENGLER: His nickname is "The Hammer."
Stantz and Spengler are seated with their attorney LOUIS TULLY,
lawyer, CPA and former demonic possession victim. Louis is
desperately paging through a mountain of legal textbooks.
LOUIS: (nervous) I think you're making a big mistake here, fellas. I do mostly tax law and some probate stuff occasionally. I got my law degree at night school.
STANTZ: That's all right. We got arrested at night.
I'd suggest that given the judge's complete disregard for the Ghostbusters and their ghostly world, it was important to the team to have an attorney who actually believed in them, rather than some intelligent attorney who regarded them as quacks.
As you rightly say, the ghostbusters are highly intelligent individuals. But they're also highly unusual individuals, given their work. Perhaps it meant more to them to have someone value that, than "win" their case by discrediting them.
On another note, a very possible answer is also "Because." Given the severity of the charges they faced, it's of course logical they would take on serious legal help, instead of a night lawyer. But sticking with Louis, we have more Rick Moranis screen time and funny side story to the main plot. So whilst this reason is "out of universe", it's also very plausible.