Okay kiddo, so a long time ago there were many small kingdoms in India ruled by kings and queens. These kingdoms were called princely states.
These rulers were very powerful and they had their own armies, laws and money. They also had lots of palaces and lived a luxurious life.
During the British rule in India, these princely states were allowed to keep their independence and continue ruling their own kingdoms. However, they had to accept British sovereignty over them and pay taxes to the British government.
After India got its independence in 1947, the government wanted to bring all these princely states under one country. So, they asked these rulers to join India or Pakistan.
Most of the rulers agreed to join India and the government made them into union territories. They were given some powers, but the real power was with the Indian government.
Today, India is one big country with many states and union territories, and all of them follow the same laws and rules.