Both words mean "cold" but the usage is very different.
さむい is generally used when the ambient air temperature is too low to be comfortable and its opposite is 暑(あつ)い.
今日は寒いです(きょうはさむいです)。It is cold today.
北欧は寒いです(ほくおうはさむいです)。Northern Europe is cold.
You can also use さむい when your whole body feels cold although you can’t pinpoint any object that is making you feel cold. For example, when you are feeling the chill just before you run a fever because of an infection or something like that.
When you can pinpoint what feels cold, you can use 冷(つめ)たい and its opposite is 熱(あつ)い. (Please note the same sound with different kanjis.)
水が冷たい(みずがつめたい)。The water is cold.
エアコンの風が冷たい(えあこんのかぜがつめたい)。The wind from the air conditioner is cold.
冷たい言葉に泣いた(つめたいことばにないた)。I cried for the cold words.
While さむい implies discomfort, つめたい is not always negative.
冷たい水がおいしかった(つめたいみずがおいしかった)。I found the cold water delicious.