Correct option is B
Explanation: With as if to show an unreal/hypothetical present situation, we use the past tense (unreal past/subjunctive sense). The speaker implies he does not actually know everything; it only seems so. Therefore, “He behaves as if he knew everything” is the idiomatic, grammatical choice.
Grammatical rule used: After as if / as though to express an untrue or doubtful present situation, use a past-tense verb (often called the unreal past), e.g., He talks as if he were the boss.
Example: She looks at me as if she knew all my secrets.
Information booster: When the situation is contrary to fact in the past, we use past perfect after as if: He spoke as if he had seen the accident.