This reaction is based on the free radical substituion concept. i.e., it is completed in the form of free radical mechanism.
So, in the presence of sunlight, the substition takes place fromt the side chain while in the presence of `FeBr_(3)`, teh substituion takes place from the benzene mucules.