I imagine you're wrong, and I take it you are suggesting that he decided here to overrule his political advisors who you've already imagined telling him not to say anything.
His legal advisors will advise him on what he can say within the legal rules. I suspect they will have advised him that his comment would be within the legal rules if he chose to make that comment.
His political advisors would advise him not to comment where commenting would not be to his political advantage and to comment where it is to his political advantage. They will also (of course) say that any comment must be OK legally, but that would be for the legal team, not them to comment on.
It's a politically idiotic statement.
Not really - now that he is leader of the SNP, he needs to protect the SNP as far as he can. And he needs to protect his position as leader of the SNP as far as he can. That is what is in his political interest.
He was asked whether the SNP was operating criminally
now, since he became leader. It is clearly in his political interests to say that
now, since he became leader that he believes that the SNP isn't operating criminally. It is politically in his interests as to suggest otherwise, or even not to comment, would be bonkers. It also helps (and boy does he need help) to create a narrative that he is cleaning up the mess - that things weren't right in the past, but they are now OK.
It's a legally stupid one.
Really? He was asked, and commented on, the situation now. The criminal investigation is about past events. Why is it legally stupid to comment on the current position, which as far as I am aware isn't the subject of police investigations.