Objects can get flung out of solar systems when they pass close to large objects. Similar to how spacecraft get gravity assists.