Thanks to stems from how you're either thanking yourself, someone else, or something else for helping you achieve something.
Because of, is just saying it happened due to something. They both can be used interchangeably.
Example: I passed my exams, thanks to my hours of studying.
I passed my exams due to hours of studying.
I passed my exams, because of my hours of studying.
Do NOT use thanks to if it's just a "because" though and not a "because of".
You would have to change the grammar.
Example:
I passed my exams, because I studied.
I passed my exams, thanks to I studied. (THIS WOULD BE WRONG)
You would have to write:
I passed my exams thanks to my effort in studying.