The males do this because females will eat the eggs right after spawning if the male does not run her off. The males continue to protect the eggs until they have absorbed their yolk sac and are ready to distribute themselves.
Males exhibit this action because females would devour the eggs right away following spawning unless the male successfully chases them off. Males continue to guard the eggs until they have fully utilized their yolk sac and are ready to spread out.