Here's why:
* Water: HBr is a polar molecule, meaning it has a positive and negative end due to the difference in electronegativity between hydrogen and bromine. Water is also a polar molecule. "Like dissolves like," so polar substances tend to dissolve in other polar substances. The interaction between the positive end of HBr and the negative end of water (and vice versa) creates strong intermolecular forces that allow HBr to dissolve.
* Oil: Oil is a nonpolar substance, meaning it does not have a significant charge separation. Since HBr is polar, it cannot form strong interactions with oil molecules, and therefore does not dissolve.
Therefore, HBr is soluble in water and insoluble in oil.