The book does not give the reason in so many words. It shows that Rubião was the philosopher's only friend and his nurse, and that the will, opened after the death, makes him universal heir with a single condition: to keep the dog.
The will leaves everything to Rubião, with no bequests to anyone: houses in the Court and in Barbacena, slaves, bonds, shares, jewels, money and books. The condition is to keep the dog Quincas Borba, to treat him as if he were the testator himself, "sparing nothing for his benefit," and to care for him "as if he were not a dog, but a human person." When the dog dies, he must give him a decent burial on his own land and keep the bones in an urn of precious wood. The testator explains that he gave the dog his name "out of the great affection I had for him."
Before that, the philosopher had already linked the two. In chapter VII he asks Rubião whether he is his friend and hears: "As much as or more than this animal." When leaving for Rio, he says that he does not entrust the dog to anyone "but you."
Rubião expected a bequest of five to ten contos and receives "everything." He finds the clause natural, but thinks only of the inheritance. Remembering that he had given the dog to comadre Angélica, he runs to recover him, fearing that the unfulfilled clause would put the inheritance at risk, and explains to the comadre that he is only a "custodian." The dog, in fact, accompanies Rubião to the end.