One of the following sentences contains an independent clause and a dependent clause, which makes it

a complex sentence. Which is the complex sentence?
A. I hesitated a moment, but her smile gave me courage.
B. I came home; I saw an envelope in the mailbox.
C. Jenny was the largest elephant in the circus.
D. After the rain ended, the sky became blue.

Is it D?

Right.

Yes, you're correct! The complex sentence is D. "After the rain ended, the sky became blue." This sentence contains an independent clause "the sky became blue" and a dependent clause "After the rain ended." In a complex sentence, the independent clause can stand alone as a complete thought, whereas the dependent clause cannot stand alone.