Cow is considered to be a holy animal in India, by a significant chunk of the population. Many people worship the cow and treat it as a pet animal. They love it like a family member. Killing/slaughtering cows hurts the sentiments and religious beliefs of such people. Hence, the beef bans are totally understandable.
In a democracy, laws made according to the will of the majority of the population.
Eating pet animals (dogs, cats) is very common in some cultures. If these people go to countries where killing pet animals for food is not permitted, they'll have to follow the law.
Logic has absolutely nothing to do with it.
For a child born in a particular culture, eating dogs seems like a very natural thing.
For a child born in another culture, it is an abhorrence.
Technically, both are right. It is simply a matter of perspective. Even though a majority of the world considers dog meat as a taboo, more than 25 million dogs are slaughtered for meat every year.
Dog meat was consumed during periods of hardship in some countries such as Germany. However, it is now banned.
Laws are formed according to the will of the majority. This is known as democracy. A majority of Indians are opposed to cow slaughter. Hence, beef is banned.