Why are iPhone X photos higher quality than iPhone 7?
In addition to the answer offered by Nimesh, there's also the issue of how you compared the photos.

My assumption is that you were just checking them out on your iPhones, and this probably explains a lot of what you noticed because the display on an iPhone X is leaps and bounds above that used in an iPhone 7. More specifically:


the iPhone 7 incorporates a Retina HD LED-backlit LCD display with a resolution of 1334 x 750 pixels
the iPhone X uses a Super Retina HD OLED display with a resolution of 2436 x 1125 pixels


Not only is the iPhone X's resolution much higher, but it uses an OLED screen as opposed to an LCD one. Photos viewed on this will appear to look significantly better than those displayed on an LCD.

In other words, while the iPhone X is definitely taking better photos, how much better they're looking is exaggerated if you're viewing them on an OLED display, as opposed to viewing the photos on the same display.

So, for a valid comparison you'd need to view the photos from both devices on the same display (e.g. on the same computer) to get a better sense of how much difference there was in the quality.