The Beagle Boys were actually an accident by Xehanort's part. The old master never even wanted to include these idiots, but when they tried to attack and free the other villains, Xehanort had to defend himself and his property. It was only by coincidence that by fending off the goons did he somehow stab each and every one of the Beagle Boys with his keyblade without looking, causing them to succumb to darkness and split into slightly humanoid Heartless Elite and Creeper Nobodies, all under the dark lord's command.
They were among the invasion force upon Duckburg, serving as Flintheart Glomgold's Heartless' bodyguards. They were fought at the doorway to the treasure room and were defeated rather quickly, allowing Sora to slay the Creeper Nobodies that had been their bodies and force the nothing dust back onto the walking hearts to recreate them back into their normal, yet still idiotic selves.