Trevor was Neville’s pet toad, whom he frequently lost during his first year at Hogwarts (PS6). Eventually, Trevor wandered off and joined the other amphibians in and around the Lake (Pm). Trevor was a gift from Neville’s Great Uncle Algie in recognition of the first time Neville showed magical talent (PS7).
Trevor is Neville Longbottom's pet, given to him by his Great Uncle Algie. When not at Hogwarts, Neville and Trevor live with Neville's grandmother, Augusta Longbottom".
Other canon notes and references
Toads are one of the kinds of pets Hogwarts are allowed to bring to school with them, but, according to Hagrid, pet frogs have been unfashionable for some time (PS5).
Rowling was asked if there was anything special about Trevor. Her response:
Q: Can you tell us a bit more about Trevor the Toad? Is he an animagus of Neville's Uncle Algie?
JKR: See, I love all these theories, I really love this. Ummm, no. But I love the fact that everyone is now so tuned in to the Harry Potter world that every tiny part and character is closely examined through a microscope by devoted readers to decide what they're hiding. But no, Trevor really is just a toad. That is definitely it. He's not the dead Dumbledore come back to help anyone... (BP2)