This answer is just MY opinion, so I hope someone also answer this.
When we say "で", the focus is the methods (like HOW you do).
When we say "に", the focus is the destinations (like WHERE you go).
EX) 私は電車で公園に行きます。
I go to the park by the train.
"に" and "へ" are even harder to differentiate lol
When we say "に", the focus is the destinations (like kind of focus on that).
When we say "へ", the focus is the destinations (like REALLY focus on that).
We say "に" for also time.
EX) 私は午後2時に公園へ行きます。
I go to the park at 2pm.
(We don't say "私は午後2時に公園に行きます". It sounds awkward.)
I hope it helps :)