The phrase is quite popular but I wish to know its origin. Is it possible that it has something to do with childbirth (also called kidding)?
Time for OED!
It seems to come from ‘make a kid of,' according to the Oxford English Dictionary.
So when I kid you, I am fooling you, and using your innocence (a childlike quality).
Or maybe I am treating you like a child.
Kid is also slang for a child. So: "kidding me" could have come from "being childish with someone" or "Lying to someone" or "Childishly joking with someone" in a sense.
-Look! There's an elephant right behind you! -person turns around -Just kidding!