The current trend is that everyone is competing to have a camera with large megapixels. But with bigger megapixels your photos will also be better?
All cameras, DSLR, pocket, even cellphone cameras have something called a camera sensor whose main function is to convert the captured light into digital data which we then see as photos. Camera sensors vary, the sensor on a cellphone is the smallest sensor, and the sensor size (sensor surface area) also varies, some are 1/1.2 inch, 1/1.7 inch and 1 inch.
Usually on DSLR cameras the sensors are divided into 2, namely APSC (Advance Photo System Classic) and full frame. APSC sensor size is 22 x 15 mm and 50 x 39mm for full frame sensors. But these sizes are not always the same, depending on each manufacturer. Well, the sensor affects image quality. So it's not surprising if there is a 16 megapixel cellphone, but the image quality is inferior to a 12 megapixel DSLR camera.
Megapixels show how big the photo will be when printed, for example 8 megapixels has a print size of 28x20 cm (11 x 8 inches). Usually cameras with large megapixels are used for photos of billboards on the streets.
So, having a large megapixel doesn't guarantee that your photos will be good, you need to know what the sensor is first, which has a greater influence on the quality of the photo. Apart from that, many other factors influence the results of the photo, such as skill and the lens used.
However, cameras with large megapixels have the advantage, namely that you can crop your photos very small from the original photo but the results are still quite sharp as in the example below: