Question: how did the gryffindor sword get to neville longbottom?
Answer: This sword was enchanted by Godric to appear whenever a member of his house asks for help while wearing the Hat. Twice, in the course of the Harry Potter series, the sword is transported from a temporary owner to aid a Gryffindor who needs a weapon.