わざわざ is a 副詞（ふくし） (adverb) that is used to express when someone has gone out of their way to achieve a certain result. It may be translated as ‘expressly’, ‘especially’, or ‘to go out of one’s way to (A)’.
わざわざ will usually be used at the beginning of sentences, before some statement will be made about an active that was intentionally done.
You went out of your way to buy me my favorite manju? Thank you!
I don't understand the reason to go out of my way to go into an office to work, I can work from home.
わざわざ has a tendency to be used positively, although it may be used with negative connotations as well.
Thank you very much for going out of your way to come here. (Positive)
Why do you go out of your way to say something so mean? (Negative)
Although almost never used, 態態（わざわざ） may be seen in this kanji form. 態（わざ） is a kanji used to express ‘purpose’, or ‘intent’. Generally, it refers to someone's ‘willingness’ to do something. As such, わざわざ just expresses that (A) is something that the speaker has as a strong goal. How it will be translated depends more on whether the actual result is positive, negative, or undecided.
Positive result - To purposefully do (A), with the result of (A).
Negative result - To have every intention of (A), with the actual result of (B).
Undecided result - To be intent on (A), with (A) hopefully happening.
わざと is a construction that comes from the same kanji as わざわざ. わざと generally only conveys ‘on purpose’, while わざわざ has many more potential meanings (due to being stronger).
You pushed me on purpose, didn't you? You are the worst.
Why do you come here especially to bother me?