A transponder in most planes look something like this
(source)
The code is changed by turning the knobs beneath the numbers. Lets say you are assigned 5700 as your code but your previous code was 7456. If you careless or start from the right most knob your transponder will briefly be set in 7700 until the most significant digit is changed. If the radar does a pass (interrogation) at that time ATC will momentarily receive a 7700. Some people say you should put your transponder in standby (SBY) mode when changing codes to avoid this happening.
Some GA planes (and even some larger planes) have newer digital interface transponders like this one,
(source)
These make it a bit harder to pass through the codes since you are not turning knobs but in bumpy air you could accidentally double tap a number. For example lets say you are assigned 7003 in bumpy air. You go to hit the 7 and accidentally double tap the button. Then you type in the 00 and your code is complete by the time you hit the 3.