Bucks need defense and a PG, and Dunn offers both. He's shooting really well on limited attempts, so teams wont be as scared to add him to stars as they were previously.
They have the Portland 2nd rounder and Beauchamp as quality trade pieces.
Danny does it because he wants Keyonte to be the starting PG and Beauchamp fills the Ochai void.
Dealing Dunn would also be another signal the Jazz dont want any long-term pieces who are older than Lauri, which seems to be the case w/ KO/Simone being dealth when they could have been re-signed.