Same as any other gun except with an electrical charge igniting the powder rather than a firing pin hitting into rimfire/centerfire cartridge. The trigger completes a circuit with the battery, which ignites the powder and sends the pellets shooting down the barrels. From diagrams it looks like the doohickey wasn't designed to be reloaded.
Guns with electrical firing aren't unheard of though, they're just more common in things like very large guns like artillery or guns on a fighter jet. The famous M61 vulcan cannon for instance often has electrically ignited primers.
Yamagami (the assassin) claimed to have made the gunpowder himself. I've read speculation that he made it from black powder sourced from fireworks. I remember he said something about "drying" his powder, so he possibly was trying to dehydrate black powder he got from really shitty sources. He could have also been sourcing potassium nitrate from...somewhere. Some people who make homemade explosives will extract KNO3 out of soil fertilizer.
They weren't shells, but rather, the pellets and powder were sealed inside the barrels themselves. Probably to protect against moisture, since even the slightest amount of moisture makes black powder difficult to ignite (look at the history of flintlock guns refusing to fire in the rain). Not sure where Yamagami got the pellets, but he could have easily DIY'd some little metal balls, since that's all they are.