The device you are talking about is called a transponder. This is a device that listens for a signal (an interrogation) and responds with information about the airplane including an ATC assigned code, altitude information and additional aircraft info for certain equipment.
There are 2 ways ATC watches airplanes:
The transponder is interrogated by the Secondary radar and the response is listened for. Even with no transponder, the aircraft can still be tracked by primary radar. This is just a normal radar that is good at seeing airplane sized objects and not so great at seeing weather and can occasionally spot a large flock of birds. The primary radar is what provides the "blip" on radar and tracks the airplane. The datablock ATC has on the airplane comes from the secondary, so what ATC will see is a blip with no information. Turning off the transponder is as simple as setting it to OFF or pulling a circuit breaker and yes, it can be selected OFF in flight, it is just a switch.
The problem with radar is that it only works so far from a radar transmitter and the further away you are the higher you must be to be seen by the radar. Over the ocean away from land, you are going to be on the fringe of radar or out of radar contact completely and thus unable to be tracked directly by ATC (at this point, non-radar procedures such as position reporting and ETAs can be used to track positions).
The flight in question was apparently visible by a military radar before it disappeared from the scopes (it allegedly observed what appeared to be a turn back toward its origin).