He's tricked and manipulated into it by Elektra.
She tells him that she killed the monks of K'un-Lun and pretending to try to bring him into the Hand all to get him angry.
She taunts him and beats him in a fight until he turns to the one weapon he has that he thinks that will beat her....the one weapon that he knows she wants and he does it anyway even after telling her that he wouldn't give it to her.
Danny Rand has shown himself to be childish, impetuous and unable to control his emotions and Elekta plays him like a fiddle.
When he finally commits she uses footwork, positioning and martial arts moves to trap the iron fist and turn it to the target she wants.