Can’t move hierarchy to collection or parent in outliner
An object(A) in a certain collection (lets call it Collection 1) can be parented to an object(B) in another collection (lets call it Collection 2), while it(A) remains in Collection 1.
So what you are experiencing is normal/intended behavior.
If you want the child(A) to also be in the same collection as its parent(B), simply select the object(A), press M to move it to another collection, and choose the one the parent is in (Collection 2).