Despite what you learned as a kid, you can get caught in a lie when you tell the truth. Part of the "game" of adversarial court is trying to get as many legally admissible statements from opposing witnesses as possible. Once enough statements have been entered into evidence, lawyers find contradictions - it doesn't matter how small. Humans don't say the exact same thing every time - it's not too hard to create the appearance of a contradiction where none exists - and sometimes prosecutors get it wrong and think they hear a contradiction where none exists. Good defense lawyers keep their clients (innocent or guilty) out of the witness box as much as possible.
Seeing as how the expert testimony is far from being in the least bit conclusive but allegations were presented as such, it's not hard to see why it is best to say nothing. Every word you utter will be used against you in the least charitable way possible, especially when the court of public opinion already thinks you're guilty.
Taking the fifth is not automatically a sign of guilt despite what some people might think.
As I understand it it's not out of the realm of possibility for a lawyer to advise doing so even for completely innocent clients. It's not hard to get tripped up on the stand and sound guilty even when you aren't.
It's one thing to take the fifth out of an abundance of caution when all it might do is raise some suspicion. It's another thing when doing so is likely to cost you $250MM. It's hard to look at this course of events and conclude that Levandowski probably did nothing wrong.