I know dzięki is thanks and temu I knew as "ago".. like sto lat temu..
Temu in "sto lat temu" is different than
temu in "dzięki temu". In the latter, it is the dative case of the zaimek wskazujacy
ten/ta/to: dzięki czemu? dzięki temu! In the former, temu is an idiomatic word equivalent to the English "ago", although it definitely takes its root in the zaimek ten/ta/to. See the following sentence: minęło sto lat od tego [czasu/wydarzenia] = zdarzyło się sto lat temu.