but why do dogs smile when they are happy?
i don't think bananas get happy.
I think lots of animals are capable of smiling.
It can be hard to interpret though. Just like if dogs are playing or fighting. The only way to know this is to watch and see where it goes. Many animals show their teeth when angry, threatened, happy, or if something feels good (like scratching an itch). Horses smile sometimes when they scratch their ass on a fencepost.
I think what makes it a smile is context and an array of other physical expressions (like squinting of the eyes, posture, tail movement, &c.). I don't think humans selected dogs for their smile.
Most people think that dogs selected humans by lingering around campsites and scavenging for food. Eventually people learned to like them.