We investigate the dynamics of an injected outflow propagating in a progenitor in the context of the collapsar model for gamma-ray bursts ( GRBs ) through two dimensional axisymmetric relativistic hydrodynamic simulations . Initially , we locally inject an outflow near the center of a progenitor . We calculate 25 models , in total , by fixing its total input energy to be 10 ^ { 51 } \mbox { ergs s } ^ { -1 } and radius of the injected outflow to be 7 \times 10 ^ { 7 } cm while varying its bulk Lorentz factor , \Gamma _ { 0 } = 1.05 \sim 5 , and its specific internal energy , \epsilon _ { 0 } / c ^ { 2 } = 0.1 \sim 30 ( with c being speed of light ) . The injected outflow propagates in the progenitor and drives a large-scale outflow or jet . We find a smooth but dramatic transition from a collimated jet to an expanding outflow among calculated models . The opening angle of the outflow ( \theta _ { sim } ) is sensitive to \Gamma _ { 0 } ; we find \theta _ { sim } < 2 ^ { \circ } for \Gamma _ { 0 } \gtrsim 3 . The maximum Lorentz factor is , on the other hand , sensitive to both of \Gamma _ { 0 } and \epsilon _ { 0 } ; roughly \Gamma _ { max } \sim \Gamma _ { 0 } ( 1 + \epsilon _ { 0 } / c ^ { 2 } ) . In particular , a very high Lorentz factor of \Gamma _ { max } \gtrsim 100 is achieved in one model . A variety of opening angles can arise by changing \epsilon _ { 0 } , even when the maximum Lorentz factor is fixed . The jet structure totally depends on \Gamma _ { 0 } . When \Gamma _ { 0 } is high , a strong bow shock appears and generates a back flow . High pressure progenitor gas heated by the bow shock collimates the outflow to form a narrow , relativistic jet . A number of internal oblique shocks within the jet are generated by the presence of the back flow and/or shear instability . When \Gamma _ { 0 } is low , on the contrary , the outflow expands soon after the injection , since the bow shock is weak and thus the pressure of the progenitor gas is not high enough to confine the flow . Our finding will explain a smooth transition between the GRBs , X-ray rich GRBs ( XRRs ) and X-ray Flashes ( XRFs ) by the same model but with different \epsilon _ { 0 } values .