She was happy to have passed the exam.

Literal

She [topic-は] exam [target-に] passed [and-て] was-happy.

The te-form here links cause and effect: the passing is the reason for the happiness. The structure [event]+て+[emotion-adjective] is one of Japanese's most natural ways to attribute an emotional reaction to a cause: ふられて悲しかった ('was sad because I got dumped'), 会えて嬉しい ('happy to meet you'). The te-form does the work that English handles with an infinitive ('happy to have passed'), without needing an explicit causal conjunction.