As Valorum pointed out, experimental ornithopters date back at least to Leonardo da Vinci and probably earlier. Working ornithopters have been built in the real world; I used to have a toy that flew by flapping light Mylar wings. Google Ngram Viewer shows that the word ornithopter dates back at least to 1866, though it didn't "take off" till after the Wright Brothers' successful flight with a fixed-wing aircraft in 1903.
But all of that's in the real world. Presumably the OP wants to know when this concept entered science fiction. Obviously, Frank Herbert's Dune (1965) made use of ornithopters, but he wasn't the first. In 1964, Cordwainer Smith mentioned "police ornithopters" in his short story "The Dead Lady of Clown Town". That probably isn't the first use of ornithopters in science fiction either. I'm not counting the ancient myth of Daedalus, who was said to devise wings made of feathers and wax, because his invention doesn't seem to satisfy the definition of an ornithopter as a machine that flies by flapping its wings.
As to ornithopters that use the dragonfly instead of the bird as a model, in film they include Stars Wars: Episode III, Revenge of the Sith (2005), in which Wookiees fly Raddaugh Gnasp fluttercraft. In written form, as pointed out by coppereyecat, they go back at least to James Gurney's Dinotopia: the World Beneath (1995). The author discussed his inspiration in a 2009 blog.