The side opposite to angle B is the side that does not contact with angle B.
In this attached image, you can see better that sides AB and BC is in contact with angle B. So, the opposite side to angle B is AC.
Therefore, the lenght of the side opposite to angle B is 4 units.