What decides the velocity of a bullet coming out from the gun? I was concerned about what determines the speed of the bullet coming out from the gun.
Is it determined by the strength of the explosive or how fast does it burn up?
For example if we take the same amount of gun powder and a plastic explosive (probably TNT) in a bullet shell which bullet will go further the one with the plastic explosive or the one with the gun powder
 A: The change in kinetic energy of the bullet is equal to the work done on it, and this is just the integral of the force on the bullet along the barrel. The force is (roughly) the pressure in the area behind the bullet times the cross sectional area of the barrel.
The pressure:time curve is going to be a complicated function of the amount of explosive and how fast it generates gas. Obviously a fast burning high yield explosive will do more work on the bullet than the same amount of a low yield slow burning explosive. Aside from this rather obvious generalisation, you'd need figures on the rate of burning and yield of black powder and TNT to answer your question. Having said this, since black powder is slow burning compared to explosives like TNT that use an intramolecular reaction it seems highly likely that TNT would give the higher muzzle velocity.
A: Besides, the amount of energy produced by TNT is $4686\,J/g$ while for gunpowder it is about 2/3 of that (it would depend on the type of gunpowder). 
So, naively, you could expect that if all the energy in the explosive is transformed into kinetic energy, the TNT loaded projectile would go faster.
A: 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.
