First polarization study of the M87 jet and active galactic nuclei at submillimeter wavelengths with ALMA