Please do not stereotype India. India is a very huge country. Not every part of India is the same especially with cleanliness.
Kerala is a small state in India with the highest literacy level. There is no open defecation in Kerala. Infact if you read about Kerala, you will be very surprised how different it is from the rest of India.