When a Pokémon with the Illusion ability switches into battle, it takes on the appearance of the Pokémon in the last slot (6th) of the player's party. Illusion will not activate if the last-slot Pokémon is fainted or the same species.
The effect is purely visual; Illusion does not change the Pokémon's type or moves. For instance, a Fighting-type move used against a Zoroark disguised as Gengar will still be super effective. Any direct attack (i.e., not entry hazards, weather, etc.) will "break the illusion."