First of all, you need to identify the types of your Mac hard drive, be it an SSD, HDD, Fusion drive, or some others. If you are using an internal SSD or a flash storage device, it will automatically convert HFS+ to APFS when upgrading macOS, and keeps the data intact.
To check the built-in hard drive on Mac, go ahead to the Apple menu > About This Mac, and choose the Storage tab, under the icon of the drive, it tells the type of your Mac hard drive, such as Flash Storage.
Secondly, check whether your Mac supports macOS 10.13 and later versions. (Read more: [Answered]What macOS/OS X Can My Mac Run?) If it does, you can directly go to the Apple menu > System Preferences, and select Software Update, then download and install the latest available update.
In case, upgrading macOS on an internal HDD, Fusion drive, or another external hard drive couldn't convert Mac OS Extended(Journaled) to APFS, you can manually convert the file system in Disk Utility. Although it should not erase the stored content, you'd better back up the drive just in case.
Step 1. Launch the Disk Utility tool via Launchpad.
Step 2. Click the View button and select Show All Devices.
Step 3. Control-click the target drive/partition and choose Convert to APFS.
Read more: Convert to APFS Option is not Available or Greyed Out in macOS