A coilgun uses magnetism to accelerate a projectile down a barrel. The magnetic force is created using a coil of copper wire attached to a capacitor. When the capacitor is tripped (the electricity stored within transmitted through the coil) the electricity flowing through the wire creates an instantaneous magnetic field that acts on the projectile and moves it forward. By the time the projectile gets to the coil the energy in the capacitor is spent, meaning that the magnetic field disappears and doesn’t keep the projectile from continuing on its path. Multiple coils can be used in series to increase the velocity of the projectile. This is different from a railgun, which introduces electric current to the projectile itself instead of a coil.
Because the force acting upon the projectile is magnetism and not a chemical reaction (like gunpowder) this is technically not a firearm. However, quick witted ATF boffins may note that a chemical reaction in the battery is the actual primum movens in the mechanism. In other words, I sure hope the ATF doesn’t get wind of this and start classifying batteries as ammunition.