The pronunciation of g is determined solely by the following letter (apart from a few recent imports). This is unrelated to g being the first letter of the word.
G followed by e,i or y is a “soft G”, i.e. the [ʒ] sound (a voiced palato-alveolar sibilant). This sound is rarely present in English: words like “jerry” have a /dʒ/ sound. The French soft g, which is also the pronunciation of the letter j, is the pronunciation of s in English words like vision or Asia.
G followed by a, o, u or a consonant, or g at the end of a word (when it's not silent), is a “hard G”, i.e. the [g] sound (a voiced velar plosive), i.e. the g in “girl”.
When a hard G sound is needed before e, i or y, French spelling adds a silent u: the u modifies the pronunciation of the g but does not introduce a vowel sound. Example: ligue (a league), pronounced [lig] (rhyming with “big” in English). Conversely, -ge- can be used before a, o or u to force a soft G; etymology dictates whether the spelling is -ge- or -j-.
The same distinction exists for c, which is a soft C ([s] sound) before e, i or y, and a hard C ([k] sound) everywhere else. (Incidentally, English has the same rule for C.) There are a few words where -cu- is used to transcribe a [k] sound (e.g. écueil (reef): [ekœj]), but usually -qu- is used instead. A cedilla on a c (i.e. ç) forces the soft sound.