Context. Young giant planets and brown dwarf companions emit near- infrared radiation that can be linearly polarized up to several percent. This polarization can reveal the presence of an (unresolved) circumsubstellar accretion disk, rotation-induced oblateness of the atmosphere, or an inhomogeneous distribution of atmospheric dust clouds. Aims: We aim to measure the near-infrared linear polarization of 20 known directly imaged exoplanets and brown dwarf companions. Methods: We observed the companions with the high-contrast imaging polarimeter SPHERE-IRDIS at the Very Large Telescope. We reduced the data using the IRDAP pipeline to correct for the instrumental polarization and crosstalk of the optical system with an absolute polarimetric accuracy $łt$0.1% in the degree of polarization. We employed aperture photometry, angular differential imaging, and point-spread-function fitting to retrieve the polarization of the companions. Results: We report the first detection of polarization originating from substellar companions, with a polarization of several tenths of a percent for DH Tau B and GSC 6214-210 B in H-band. By comparing the measured polarization with that of nearby stars, we find that the polarization is unlikely to be caused by interstellar dust. Because the companions have previously measured hydrogen emission lines and red colors, the polarization most likely originates from circumsubstellar disks. Through radiative transfer modeling, we constrain the position angles of the disks and find that the disks must have high inclinations. For the 18 other companions, we do not detect significant polarization and place subpercent upper limits on their degree of polarization. We also present images of the circumstellar disks of DH Tau, GQ Lup, PDS 70, ensuremathβ Pic, and HD 106906. We detect a highly asymmetric disk around GQ Lup and find evidence for multiple scattering in the disk of PDS 70. Both disks show spiral-like features that are potentially induced by GQ Lup B and PDS 70 b, respectively. Conclusions: The presence of the disks around DH Tau B and GSC 6214-210 B as well as the misalignment of the disk of DH Tau B with the disk around its primary star suggest in situ formation of the companions. The non-detections of polarization for the other companions may indicate the absence of circumsubstellar disks, a slow rotation rate of young companions, the upper atmospheres containing primarily submicron-sized dust grains, and/or limited cloud inhomogeneity. Based on observations collected at the European Southern Observatory under ESO programs 098.C-0790, 0101.C-0502, 0101.C-0635, 0101.C-0855, 0102.C-0453, 0102.C-0466, 0102.C-0871, 0102.C-0916, and 0104.C-0265.