Context : Two competing models describe the formation of massive stars in objects like the Orion Trapezium . In the turbulent core accretion model , the resulting stellar masses are directly related to the mass distribution of the cloud condensations . In the competitive accretion model , the gravitational potential of the protocluster captures gas from the surrounding cloud for which the individual cluster members compete . Aims : With high resolution submillimeter observations of the structure , kinematics , and chemistry of the proto-Trapezium cluster W3 IRS5 , we aim to determine which mode of star formation dominates . Methods : We present 354 GHz Submillimeter Array observations at resolutions of 1 \arcsec – 3 \arcsec ( 1800–5400 AU ) of W3 IRS5 . The dust continuum traces the compact source structure and masses of the individual cores , while molecular lines of CS , SO , SO _ { 2 } , HCN , H _ { 2 } CS , HNCO , and CH _ { 3 } OH ( and isotopologues ) reveal the gas kinematics , density , and temperature . Results : The observations show five emission peaks ( SMM1–5 ) . SMM1 and SMM2 contain massive embedded stars ( \sim 20 M _ { \sun } ) ; SMM3–5 are starless or contain low-mass stars ( < 8 M _ { \sun } ) . The inferred densities are high , \geq 10 ^ { 7 } cm ^ { -3 } , but the core masses are small , 0.2 - 0.6 M _ { \sun } . The detected molecular emission reveals four different chemical zones . Abundant ( X \sim few 10 ^ { -7 } to 10 ^ { -6 } ) SO and SO _ { 2 } are associated with SMM1 and SMM2 , indicating active sulfur chemistry . A low abundance ( 5 \times 10 ^ { -8 } ) of CH _ { 3 } OH concentrated on SMM3/4 suggest the presence of a hot core that is only just turning on , possibly by external feedback from SMM1/2 . The gas kinematics are complex with contributions from a near pole-on outflow traced by CS , SO , and HCN ; rotation in SO _ { 2 } , and a jet in vibrationally excited HCN . Conclusions : The proto-Trapezium cluster W3 IRS5 is an ideal test case to discriminate between models of massive star formation . Either the massive stars accrete locally from their local cores ; in this case the small core masses imply that W3 IRS5 is at the very end stages ( 1000 yr ) of infall and accretion , or the stars are accreting from the global collapse of a massive , cluster forming core . We find that the observed masses , densities and line widths observed toward W3 IRS 5 and the surrounding cluster forming core are consistent with the competitive accretion of gas at rates of \dot { M } \sim 10 ^ { -4 } M _ { \sun } yr ^ { -1 } by the massive young forming stars . Future mapping of the gas kinematics from large to small scales will determine whether large-scale gas inflow occurs and how the cluster members compete to accrete this material .