You probably didn't turn them upside down. Since the advent of digital cameras, modern JPEGs also store an orientation vector in the EXIF data, which tells the photo viewing app which way is up in the photo.
More than likely, your camera's hardware writes the photo in what you would consider the upside down orientation. It then sets the orientation EXIF based on the camera's tilt switch (gravity accelerometer sensor). Something you did to the photos probably erased this orientation EXIF. Or you're using a photo viewing app which ignores the orientation EXIF.
You can use this program to change the orientation EXIF in all your photos at once.
http
/savolai.net/software/JPEG-EXIF_autorotate
In the event that you need to really flip the photos 180 degrees (e.g. use them in software which ignores the orientation EXIF), you'll have to re-save the photos as new JPEGs. JPEGs are lossy, so this process usually degrades image quality. But 90- and 180-degree rotations can be done in a lossless fashion. You just need a program which knows how to do it, like this one.
http

/annystudio.com/software/jpeglosslessrotator/