The dog that follows you at the start becomes yours once you finish collecting the gold needed to open the box. After that, the dog is officially your companion.