From Sonic Retro
Most badniks contain innocent animals that the evil Dr. Ivo "Eggman" Robotnik has trapped inside robots. Usually, after Sonic destroys the robots, the captured animal is freed and skips away. Exceptions do occur, with the Doctor occasionally using plant seeds, rings, or other sources rather than creatures.
The badnik term mostly fell into disuse after Sonic Adventure was released in 1998, with animal-themed robots being gradually replaced by humanoid E-series models within the games. However, the trend reversed in later outings; the word "badnik" first reappeared in 2007 with Sonic Rivals 2, and subsequently animal-themed robots reappeared in Sonic & Sega All-Stars Racing, Sonic 4, and Sonic Colours.
Badniks in Sonic Games
Badniks are a series of robots that Dr. Robotnik uses as his primary defense force against Sonic. They are designed to run off an organic battery (e.g. a small animal) and attack Sonic as soon as they see him. Generally, the original production of Badniks resembled mechanical animals or insects themselves. They were not very competent fighters, as they usually attempted to simply run into Sonic, or fired a shot at him and then shuffled away.
Eggman's more modern robots (from Sonic Heroes through to Sonic Unleashed) are not generally described as badniks, as they lack the distinctive properties of the Doctor's earlier machines - no animal prisoner and rarely animal or insect-themed by design. Robots like the E-Series, Egg Pawn, and Egg Gunner have a more uniform, humanoid design and actually home in to fight with Sonic by using lances and shields, cannons, or just attacking him with their fists.
Badniks in Sonic the Comic
In the UK (Edgmont Fleetway) Sonic the Comic, all early Badniks were powered by Organic Batteries, the name given to the helpless Mobian trapped inside; however, stronger self-sufficient badniks known as Prime Badniks which could operate without the need of such batteries soon appeared. The first such was the Arachbot: a spider-like badnik that captured Tails in an early episode and that was resistant to Sonic's attacks until he torched it using the weapon from another badnik he had destroyed. Most badniks continued to use organic batteries, with the exception of Troopers and some special project badniks such as the Metallixs. In earlier episodes, Dr. Robotnik used mobile factories, which were basically large badniks that injested a Mobian, turned it into a robot, and then released it as a badnik; in later episodes, Robotnik used huge processing plants to churn out badniks in large numbers.
The most powerful badnik type was the Cybernik, of which only 2 were ever made: Shortfuse and Vermin. Shortfuse was the first, a prototype made of Megatal, an ultra-hard metal, designed by Grimer to destroy Sonic the Hedgehog. However, its organic battery, Shorty the squirrel, took control and joined the fight against Robotnik, unable to escape from his metal shell. Vermin was sent to destroy him but was eventually destroyed by Shortfuse.
All the Badniks on Mobius were immobilised in episode 100 along with all the electrical systems on Mobius, including Robotnik's Organic Computer on the Floating Island (but not the Floating Island itself or its ancient Guardian Robots), when Super Sonic burst out of the Black Asteroid in Mobius' orbit, transported from the Special Zone by the Omni Viewer, causing an Electro-magnetic pulse that covered the planet. Robotnik created a new batch from his new base on Flickies' Island but never regained control over the planet again.
A one off-Sonic story considered a bit of a fan favourite was that of "Smokey and the Badnik", in which a Roller badnik (which features in Sonic 1's Spring Yard Zone) befriends a young Mobian called Smokey and protects him from a Trooper attack. Sonic spares the robot once he realizes that it is harmless and the two walk off into the sunset.