This is an erroneous blanket statement. Photographing people in public is illegal in plenty of places, depending on what exactly you're doing. Taking a picture of a big crowd is usually fine. Singling out individuals sometimes isn't.
IIRC some countries recently started experimenting with automagically granting copyright to people for their own likeness, I think it was aimed at AI generates fakes, but it's probably more widely applicable.
Anyway, don't be a dick, don't take pictures of people without their consent.