Rubeus Hagrid is a fictional character in the "Harry Potter" book series written by J. K. Rowling. Hagrid keeps and has kept a variety of pets, including some which the Wizarding community considers impossible to domesticate. One of those pets was Fluffy who Hagrid originally purchased from a "Greek chappie" at The Leaky Cauldron (a popular wizarding pub and inn located in London). Hagrid loaned Fluffy to the headmaster, Albus Dumbledore, to aid in guarding the Philosopher's Stone, during the 1991–1992 school year.

Fluffy is a giant three-headed dog provided by Hagrid to guard the trapdoor leading to the underground chamber where the Philosopher's Stone was hidden until the end of Philosopher's Stone. The only known way to get past Fluffy is to lull him to sleep by playing music. Fluffy is based on Cerberus, the three-headed dog from Greek mythology that guards the gates to the underworld. As with Fluffy, Cerberus was lulled to sleep with music by Orpheus.

In Greek mythology, Cerberus was often referred to as the hound of Hades, is a multi-headed dog that guards the gates of the Underworld to prevent the dead from leaving. He was the offspring of the monsters Echidna and Typhon, and was usually described as having three heads, a serpent for a tail, and snakes protruding from multiple parts of his body.

More Info: en.wikipedia.org