A trap can either be a devilishly evil contraption the GM placed into a campaign to trick the players or to somehow outsmart them (and hopefully kill them).
Traps are a staple in Dungeons & Dragons. They can take the form of a spring loaded blade on a door to an illusionary wall or many other forms. It is generally used to screw with the players. The rogue in 3.5 and down is, pretty much, the only class that can deal with them, while in 4e anyone can effectively.