Hathiram Bhavaji or Hathiram Baba or Hathiramji was a saint from North India who visited Tirumala around 1500 CE on a pilgrimage and became a devotee of Lord Venkateswara. He settled there by setting up an ashram near the temple. According to a legend, he had the privilege of playing dice with Lord Balaji.
Hathiram was born into a middle-class family in Rajastan, North India. According to legend Hathiram named Lord Venkateswara as Balaji. Not much of historical data is available about his life.
He was a devotee of Lord Rama. When he visited Tirumala, he decided to stay there and set up an ashram outside the temple.
There is a Hathiram Bhavaji Muth established in his name in Tirumala.
It is believed that Lord Balaji was pleased with his devotion and used to come to his place to play dice with him. One day, the game went on for too long and the Lord suddenly remembered that He was getting late for the daily worship. In a hurry, He left one of His ornaments, a necklace, in Bhavaji's ashram. When the priests opned the temple for the day, they found that an ornament was missing, and instituted a search for it. Bhavaji also realized what happened, and wanted to return the ornament to the temple. He was however caught and house-arrested by the temple guards who thought he was the thief.
The matter reached the king, and he asked Bhavaji why he had stolen the ornament. Bhavaji narrated the incident of the previous night. The king expectedly did not believe the story and ordered his servants to fill the compound of Bhavaji's house with sugarcane, and asked Bhavaji to eat every bit of the sugarcane before dawn. The king also asked his guards to stand outside the house to ensure that nobody went in. Since it was practically impossible to eat such a large amount of sugarcane for any human in one night, Bhavaji simply sat chanting the name of the Lord. After he eventually fell asleep, a huge white elephant appeared inside his home, finished the sugarcane within moments, and disappeared.
In the morning, the king was surprised to see all the sugarcane eaten. He verified with his guards that no elephant was seen the previous night outside the locked house. He then realized that the Lord Himself had appeared as an elephant to save His devotee. Hathi means elephant in Hindi, and Bhavaji frequently chanted Ram. That is how he is supposed to have gotten his name.