Headbonk Goombas first appeared in Super Paper Mario. They had one Heart Point, and an Attack of 2. They are found in the Pit of 100 Trials. The reason they were created was because in the first two Paper Mario games, the Goombas attack by headbonking. However, Super Paper Mario had a new gameplay style, so there were regular main-series like Goombas along with these headbonking variations.
They also make an appearance as enemies in the game Mario and Luigi: Rivals Quest. Those are located in Goomba Valley and Forest of Illusion as very rare Goombas. Like Amazee Dayzees, they never appear in the overworld, but appear alongside other enemies in battles. They attack by doing multiple headbonks on the player, damaging up to 10 HP. Headbonk Goombas are pretty tougher than normal Goombas.
Headbonk Goombas make their first 3D appearance in New Super Mario Bros. Star. Those Goombas are rare, appearing only in a few levels. Those walk normally like goombas, but when the player is close, they'll jump trying to hurt the player.