I don't know.
It's such an epic plot malfunction that it probably does deserve a thread to itself.
One can understand Jango's motivation.
Fans of the EU will possibly read some Mandalorian/Jedi antipathy subplot in there that Lucas was no doubt ignorant of has probably been undone by the television show.
As doubleofive says he's in it for the money and he is really raking the stuff in.
He gets paid by both the Kaminoans and the Confederacy for the same job (a family tradition that Boba will continue in ESB).
He also gets a son thrown into the bargain without the need of a woman cluttering up his life which says more about the character and possibly his creator than any other line of dialogue in the film.
There is an obvious reason why Lucas did it too :
Why the Jedi should deploy this brainwashed slave army based on the confirmed bodyguard of their enemy leader, implicated as he is in the attempted assassination of a prominent senator (morally and ethically this is odd but strategically it's suicidal) and continue to do so for the full duration of the war is wonky beyond belief.
The surprise shown at their betrayal shows a deep seated stupidity that goes beyond any mystical powers of the dark side.
It's almost like Dooku and Palpatine don't want to win but feel obliged to take over because their opponents are such numbskulls.
The title is a bit dumb too, the clones don't attack.
The bounty hunters hired by Dooku attack, Obi-Wan is captured, Anakin and Padme sneak around and get themselves arrested and all three are sentenced to be executed.
The Jedi botch a rescue.
The Clones are speedily deployed on a pre-existing conflict zone.
I guess Rapid Deployment Of The Clones wasn't catchy enough.