It fits the strict definition of both, so it seems a bit weird to me that we choose to call it a diminished fifth. Seems very arbitrary as they are the same.
C to F is a perfect fourth. C to G is a perfect fifth. Found as those same notes in both major and minor. Making the interval one semitone greater than a perfect is called augmenting, making it smaller, diminishing. Thus C to F# is an augmented fourth; C to Gb is the diminished fifth. So it doesn't fit the definition of +4 and o5 - C>F# is only +4. Going the other way, F#>C is o5, while Gb>C is +4.
Yes, in equal tuning it's the same note, and asking to hear the two, the same thing would be heard. However, writing them down, they would look different, and that would give reasons why they have different names.
The interval is, as Pat says, a tritone - the two notes are as far away from each other as possible, looking at a circle with all notes around it, and the sound is quite dissonant - thus being christened the 'Devil's interval', and banned for many years in the early days of music.
If you are moving upward, C to F# is NOT a diminished 5th. It's an augmented 4th. The names of intervals are determined by how many letters are involved in the notation of the interval. For example, from C to Gb, moving upward, IS a diminished fifth, because counting C-D-E-F-G involves five letter names. But if you spell the same sounding interval C-D-E-F#, then it is an augmented fourth. (Four letters involved equals a fourth.) On the other hand, if you are counting downward (which in general you shouldn't do), from C to F# IS a dimished fifth. C-B-A-G-F#, five letters, hence a fifth.
To reiterate, the name of any interval is determined by how many letters are involved in getting there.
Not actually relevant to the question, but an interesting sidelight in classical theory, is that a diminished fifth needs to resolve inward, to a major or minor third, while an augmented fourth needs to resolve outward, to a minor or major sixth. In ear training tests, when the teacher plays a tritone, you need to wait for the resolution before answering the question!
The trivial answer is that by choosing to call it C - F# you've defined it as an augmented 4th. 4 letters, C,D,E,F - make a 4th. If you want some sort of 5th, call the top note some sort of G. End of.
But there's a solid question here too. We often write a sharpened 4th rather than a flattened 5th. You're more likely to see a melody and chord written as A in my example than as B. But harmony theory prefers to call the interval a b5. There's a simple reason. Common Practice (and Jazz) theory likes everything to be a triad, an extension of a triad, or a modification of one of these. The 'pile of 3rds' thing. It will just about tolerate an added 6th, and goes all shifty when the 11th comes up. But, mostly, it likes triads. Therefore conventional chord naming prefers a modified 5th - which is a triad note - to a modified 4th.
You use inclusive counting and you start on C (C being 1) C --> D is a second, C --> E is a third and C --> F a fourth.
Now, in this case, C with whatever accidental going to F with whatever accidental makes a fourth. C# to F gives you a diminished fourth, C to Fb also gives you a diminished fourth. C to F# gives you an Augmented fourth and Cb to F also gives you the same interval.
In the other case you mention, C with any accidental in front of it, going to G with any accidental in front of it gives you a fifth. C - G# gives you an augmented fifth, Cb to G also gives you that interval.
You don't get to make a fourth a fifth just because you are working with enharmonic equivalents.
Because it's not C-Gb. Oooops.
I've made the same mistake as the OP when asking the question.
If C-F# is not augmented 4th, C-Gb is not diminished fifth. NOT. As pointed out in other answers, there is no way this could be, since C-F is always a fourth.