The etymology is unknown; it is from at least 1940 in American English, and may have come from a calque in German, but there's not much evidence for this. In any case, it's covered in detail by Brian Joseph's What Gives with What Gives?What Gives with What Gives?. Here's an excerpt:
The construction seems clearly to have originated in American English; the first attestation for what gives comes in 1940, in John O'Hara's Pal Joey, according to Wentworth and Flexner (1960: 574, s.v. what gives) and the Oxford English Dictionary (1989 on-line second edition).