Close encounters between young stellar objects in star-forming clusters are expected to markedly perturb circumstellar disks. Such events are witnessed in numerical simulations of star formation, but few direct observations of ongoing encounters have been made. Here we report sub-0.1″-resolution Atacama Large Millimeter/Submillimeter Array and Jansky Very Large Array observations towards the million-year-old binary protostar Z Canis Majoris in dust continuum and molecular line emission. A point source ~4,700 au from the binary has been discovered at both millimetre and centimetre wavelengths. It is located along the extension of a ~2,000 au streamer structure previously found in scattered light imaging, whose counterpart in dust and gas emission is also newly identified. Comparison with simulations shows signposts of a rare flyby event in action. Z CMa is a `double burster’, as both binary components undergo accretion outbursts, which may be facilitated by perturbations to the host disk by flybys.