で (de): place of action, means and material
で marks the context of an active action, as opposed to に's fixed point. Three dominant uses: place where it happens, means used, material it's made of.
Use 1: place where an action unfolds
With an action verb (eat, study, sleep, play), the place where the action happens is marked by で. The place isn't a destination, it's the setting of the action.
カフェで勉強する。
カフェ de べんきょう する。
Study in a café.
Use 2: means or instrument
With what you perform the action: transport, tool, language.
電車で行く。
でんしゃ de いく。
Go by train.
箸で食べる。
はし de たべる。
Eat with chopsticks.
日本語で話す。
にほんご de はなす。
Speak in Japanese.
Use 3: material
What something is made of.
木で作る。
き de つくる。
Make out of wood.
Memory trick: で vs に
Existence → に
公園に犬がいる (こうえん に いぬ が いる): "there's a dog in the park". Existence verb (いる), so に.
Action → で
公園で犬と遊ぶ (こうえん で いぬ と あそぶ): "play with the dog in the park". Action verb (遊ぶ, あそぶ), so で.