hilary doesn't have the delegates/votes to reach the magic number before the convention.
So she has her buddy Donald have a debate with Bernie so that he can call him a crazy commie, and neutralize him for hilary, before the California primaries.

Source: NBC News
LANCASTER, California — In the latest twist to this unpredictable 2016 presidential race, presumptive Republican nominee Donald Trump and Vermont Sen. Bernie Sanders independently agreed Wednesday night to debate each other.
On ABC's "Jimmy Kimmel Live!" Trump was asked if he would consider holding a debate with Sanders. Trump agreed to the idea.
"If he paid a sum toward charity I would love to do that," said the business mogul noting a Sanders vs. Trump debate "would have such high ratings."
Sanders quickly responded with a tweet reading, "Game On. I look forward to debating Donald Trump in California before the June 7th primary."
Read more:
http://www.nbcnews.com/politics/2016-election/donald-trump-bernie-sanders-agree-debate-n580641