Playing as the Infected in Left 4 Dead 2 typically requires going online, at least on Xbox, where you can't do it offline. On PC, the situation can differ, and it may be possible depending on your setup.
The Infected are usually controlled by other players in Versus mode, so an internet connection is generally needed to take on that role. If you're set on playing offline on PC, it's worth checking whether any local or custom options are available to you.