This is an unimportant note that is more scholarly than gospel. It belongs in a student manual or a modern scripture commentary or something similarly stale.
Why was Alma the younger going around in secret?
The answer can be seen by looking at the events that surrounded it as well as the text and the words of the angel to Alma.
In Mosiah 26 Alma is told:
Mosiah 26:32 Now I say unto you, Go; and whosoever will not repent of his sins the same shall not be numbered among my people; and this shall be observed from this time forward.
36 And those that would not confess their sins and repent of their iniquity, the same were not numbered among the people of the church, and their names were blotted out.
At the beginning of Mosiah 27 we read:
Mosiah 27: 1 And now it came to pass that the persecutions which were inflicted on the church by the unbelievers became so great that the church began to murmur, and complain to their leaders concerning the matter; and they did complain to Alma. And Alma laid the case before their king, Mosiah. And Mosiah consulted with his priests.
2 And it came to pass that king Mosiah sent a proclamation throughout the land round about that there should not any unbeliever persecute any of those who belonged to the church of God.
Given this context, when we read
Mosiah 27:8 Now the sons of Mosiah were numbered among the unbelievers; and also one of the sons of Alma was numbered among them, he being called Alma, after his father; nevertheless, he became a very wicked and an idolatrous man.
we should realize that Alma and the sons of Mosiah had been excommunicated. That is what it means that they are "numbered among the unbelievers". There was nothing secret about the fact that Alma was a "wicked and idolatrous man".
So why did they go about in secret?
Because it wasn't a matter of trying to simply dissuade members of the church from the truth. It was a matter of persecuting the Saints of God. He, like Saul of the new testament, was persecuting the church, not just preaching against it. So he was breaking the law the king declared against persecuting those who belonged to the church and that is why they went about in secret.
This is actually presented plainly both in the description:
Mosiah 27:10 And now it came to pass that while he was going about to destroy the church of God, for he did go about secretly with the sons of Mosiah seeking to destroy the church, and to lead astray the people of the Lord, contrary to the commandments of God, or even the king
Why was it "contrary to the commandments" of the king? Because it wasn't just preaching against the church, it was persecuting the saints.
The angel who appears to Alma says: Alma, arise and stand forth, for why persecutest thou the church of God?