There were at least two reasons this was possible.
First, there was British technology and organization. The British had military technology and organized forces that were more professional and more powerful than those of the Indian states.
Second, there was the fractured nature of Indian politics. India was not one big country when the British got there. It was split into dozens of little states. The British could pick those off one at a time and do things like playing them off against one another. This allowed Britain to gradually take more power rather than having to win a war against a large, united country.