Aims. We study the origin of tail-like structures recently detected around the disk of SU Aurigae and several FU Orionis type stars. Methods. Dynamic protostellar disks featuring ejections of gaseous clumps and quiescent protoplanetary disks experiencing a close encounter with an intruder star were modelled using the numerical hydrodynamics code FEOSAD. Both the gas and dust dynamics were taken into account, including dust growth and mutual friction between the gas and dust components. Only plane-of-the-disk encounters were considered. Results. Ejected clumps produce a unique type of tails that are characterized by a bow-shock shape. These tails owe its origin to the supersonic motion of the ejected clumps through the dense envelope, which often surrounds young gravitationally unstable protostellar disks. The ejected clumps either sit at the head of the tail-like structure or disperse if their mass is insufficient to withstand the head wind of the envelope. On the other hand, close encounters with quiescent protoplanetary disks produce three types of the tail-like structures, which we defined as pre-collisional, post-collisional, and spiral tails. These tails can in principle be distinguished by peculiar features of the gas and dust flow in and around them. We found that the brown-dwarf-mass intruders do not capture circumintruder disks during the encounter, while the sub-solar-mass intruders can acquire appreciable circumintruder disks with elevated dust-to-gas ratios, which can ease their observational detection. However, this is true only for prograde collisions; the retrograde intruders fail to collect an appreciable gas and dust from the disk of the target. The masses of gas in the tails vary in the 0.85-11.8 M Jup limits, while the total mass of dust lies in the 1.75-30.1 M ⊕ range, with the spiral tails featuring the highest masses. The predicted mass of dust in the model tail-like structures is therefore higher than what was inferred for similar structures in SU Aur, FU Ori, and Z CMa, making their observational detection feasible. Conclusions. Tail-like structures around protostellar and protoplanetary disks can act as a smoking gun to infer interesting phenomena, such as clump ejection or close encounters. particular, the bow-shock morphology of the tails could point to clump ejections as a possible formation mechanism. Further numerical and observational studies are needed to better understand the detectability and properties of the tails.