When you import or write a song in OnSong that does not have a specific key declared in the metadata of the song, OnSong must guess the key that you intended. For instance, you may import a song that is written in the key of G but starts on a D chord. By default, OnSong uses the first chord of the song to determine the key. While this may not be the most accurate way to determine the key based on the chords of the song, it's no more accurate than guessing using other means with limited information and, it's much easier to explain and understand.
Regardless, the solution is to enter the correct key as a tag in the song editor. OnSong needs to know the key in which the song is written in order to properly transpose into other keys. To do this, open the Song Editor by tapping on the text cursor icon in the Menubar to open the Song Editor. Next, tap on the information icon to open the Metadata Editor. You can then locate the key option and choose the key the song is written in using the Key Picker. You could even tap on the Detect button to have OnSong review the chords of the song and pick the best guess. You can also select between major and minor keys in the Key Picker.
You can change the way that OnSong determines the key of the song when it's not declared through a setting. To change this, tap on the gear icon in the Menubar to open the Utilities Menu and then choose Settings. Next, tap on the Import Settings option on the left and then choose Text File Handling on the right. Locate the Detect Key By option and choose the method you would like to use.