Maybe he thought he could lie to the FBI about something that was not illegal. I don't know. But he was mistaken in his assumptions.
If he had been an advisor to HRC, he would have received immunity.
But, since he was an advisor to Trump, he received an indictment.
That's how our system works now, and you are ok with that, which says a lot.