Select “Gallery” option in “Format” metabox and then click “Add media button”, after the modal box appears click “Create Gallery” and then select the photos:
After you select the photos click Update/Insert Gallery, and the editor will have “gallery” shortcode with the selected image. Remember that gallery shortcode should be placed in the first line of text.