In jazz, the Altered Scale is used over dominant 7th chords when you want to include the altered higher extensions, mainly the b9 and #9, as well as the b5 and b13.
The easiest way to find an altered scale is to play an Ascending Melodic Minor scale that's a half step higher than the dominant 7th chord. This means that for a G7 chord, you'll play an Ab Ascending Melodic Minor:
Ab Bb Cb Db Eb F G
Starting on G, this gives us the G ALtered Scale:
G Ab Bb Cb Db Eb F
The scale is usually used when on a dominant chord when it's going to resolve to a minor i chord, or when you want to add the altered extensions to the dominant chord itself.
Personally, I don't always use the altered scale because I don't naturally "hear" the bV note. I hear the natural 5th instead when I'm creating melodies. And since the goal of jazz is to play what you hear and express something, I usually can't bring myself to play the b5 there. I do use the altered scale in fast scale-like passages, though.
I suspect that 90% of jazz musicians just use the altered scale because books tell them to do so. Even if it doesn't fit their musical outlook or personalities
But if you like the scale and naturally hear those notes, then by all means, go for it!
Learn the 5 Essential Left Hand Techniques with my free ebook: Left Hand Techniques for Jazz Piano
You'll also get my weekly jazz newsletter with practice tips and inspiration