へ (read “e”) marks where you go/come/return. Used with 行きます, 来ます, 帰ります.
京都へ 行きます。きょうとへ いきます。
I'm going to Kyoto.
へ marks the direction/destination of a movement verb. Like topic は, the particle へ is written は/へ but pronounced “e”.
で on a vehicle says how you travel: 電車で = “by train”.
電車で 会社へ 行きます。でんしゃで かいしゃへ いきます。
I go to work by train.
で marks the means/method — here a vehicle. To say “on foot”, use 歩いて (no で).
と after a person means “(together) with”: 友達と = “with a friend”.
友達と 日本へ 来ました。ともだちと にほんへ きました。
I came to Japan with a friend.
と links a companion to the action. To say “alone”, use 一人で.
- いつ = “when?”: いつ 日本へ 来ましたか — note いつ never takes に.