Is it just a convention? Or there is more to it ?
Because then you would have 2 Gs in the scale. In any 7 note scale, we want 1 of each letter name so having the scale be G A B C D E F♯ G makes sense. See this question for more information about how this works.
Because the whole point of a key signature is not having to use any additional accidentals as long as you keep within the tonality specified by your key signature.
Writing G major as g-a-b-c-d-e-g♭ would mean that you constantly have to switch between g♮ and g♭ sharing the same location in the staff while the location of f goes unused. That is not helpful for singing scales. You want the "home scale" to work out one note space after the other without interspersed accidentals.
For G major, this means using f♯ rather than g♭.
The major scale is just a modern implementation of the Pythagorean diatonic scale built up from the following intervals:
- G: some arbitrary base pitch
- A: pure fourth down from D
- B: pure fourth down from E
- c: pure fourth up from G
- d: pure fifth up from G
- e: pure fifth up from A
- f♯: pure fifth up from B
- g: octave up from G
The reason we use all fourths and fifths: those intervals are distinguished by a clear, simple physical relationship: e.g. D has ³⁄₂ the frequency of G, and C has ⁴⁄₃ the frequency of G etc.. At these simple integer ratios, the notes' harmonics match up, which gives a very clear consonant result.
The reason we stop at seven notes is that further notes, such as pure fourth down from f♯, would be surrounded on both sides very narrowly (in modern terminology, by a semitone) by other notes, and that is a bit weird melodically.
So, that is the scale from which the letters are taken. The names fourth and fifth reflect the counting of four/five respectively notes from interval-start to interval-end. Thus is would make no sense to label the f♯ degree, being the fifth note up from B, as something with G in its name (which would be a sixth up).