By default, your images are sorted alphanumerically. What this means is that all numbers starting with a 1 will come before all numbers starting with a 2, etc.
For example, if you have a set of images that are named "Image_1" through "Image_300", they would be organized in the following way by default:
Image_1
Image_10
Image_11
...
Image_199
Image_2
Image_20
Image_21
etc.
To avoid having your images organized in this way, which may seem random at first glance, you will need to pad your numbers with zeros to make them all an equal number of characters long.
For example, instead of naming your images "Image_1" through "Image_300", you might name them "Image_0001" through "Image_0300." When the numbers are padded in this way, they are automatically sorted in the way you would expect:
Image_0001
Image_0002
Image_0003
etc.
Many cameras come with an option to name their images in this way by default, and if you use Lightroom or other image management software for post-processing, the export dialog will generally allow the images to be named this way as well.