When you make plans with someone to do something but then after you made the plans you cancel them and do something else with a different person. Some people think ditching is when you invite someone somewhere and they can't come but it's not.
To leave a person, place, or group of people suddenly and unexpectedly to hang out with someone else, somewhere else, or to go to another large gathering.
To leave someone or a group of people suddenly, often without their knowledge, making it all the more comical. Whoever said it comes from the German word dich is and idiot because dich means "you".