First note that bullets are driven by burning propellant. Explosives tend to turn metal into shrapnel. Firearms are designed around a Maximum Average Pressure (MAP), which is the peak tensile strength of the gun's action and barrel reduced by some safety margin. Typical MAP in rifles is around 60kPSI.
This is essential to answering your question, because it means that the peak force acting on the bullet is limited. An "ideal" propellant would maintain exactly MAP the entire time the bullet is in the barrel. Real propellants hit the peak at some point during firing but otherwise deliver lower pressure while the bullet is being accelerated in the barrel.
Given the above: Bullet velocity is primarily determined by bullet mass, bore cross-section, and barrel length.
Holding cross-section and length constant, a lighter bullet has a higher muzzle velocity (i.e., the velocity at the moment it leaves the barrel and can no longer be accelerated by the propellant).
Holding mass and cross-section constant, muzzle velocity increases with barrel length. But in practice there are diminishing returns to this – see an interesting discussion with examples here.
Holding mass and barrel length constant (and assuming the same barrel-time/pressure curve), muzzle velocity increases with cross-section because the pressure bears on a larger surface area.