Why are charges levied on selling demat shares and why are they different for different brokers?

Shares once you have purchased sits in your demat which is usually opened at either NSDL or CDSL via a Depository Participant (the company that opens your demat account). Though NSDL/CDSL are government institutions, they need to earn a revenue, and the way they earn is by charging a transaction fees whenever shares leave your demat account. Both NSDL/CDSL charge around Rs 5 per debit, that is Rs 5/Scrip/Day (immaterial of how many times you have sold during the day).

Along with NSDL/CDSL charges, the depository business is usually managed by a different department, and hence the brokers will charge over and above what NSDL/CDSL charges to meet their running cost of your demat account. The DP transaction charge, as they are called is usually negligible.