She felt sorry for the orphan and gave them a little money.

Literal

She [topic-は] that orphan [target-に] sympathized-て, money [object-を] a-little gave.

~に同情する ('sympathize with, feel sorry for') takes に for the recipient of sympathy. 同情 is built from 同 ('same') + 情 ('emotion, feeling') — feeling the same feelings, structurally similar to English 'compassion' (Latin 'feel-with'). The te-form 同情して links the sympathy to the next action — 'sympathized, [and so] gave.' お金を少しあげた ('gave a little money') uses あげる (outward giving) and the adverb 少し ('a little'). 孤児 ('orphan') is the formal Sino-Japanese word; in colloquial speech 孤児 is rare, and one would more often hear context-specific phrasings.