The first is more common in my experience, but the second is grammatical if not terribly elegant.
I believe "Give it to me" is much more commonly used, but someone told me that "Give me it" is also a common expression. Is that true? I learned from an English grammar book that I shouldn't put two pronouns as objects side by side.
I am not a teacher.
You will also hear, "give it me" in informal BrE.