These two both mean “you” in German, but when and how you use each is a bit tricky. Most textbooks don’t cover the differences well, and using the wrong one can upset or even offend people. It’s rather important to get “you” right in German.
The simple distinction in textbooks is that du is informal, creating a sense of familiarity or intimacy, and Sie (capitalized) is formal, creating a sense of respect or distance. Of course there are other uses for sie. It can also mean “she” or “it” (when the gender of the object is feminine, as in die Tür). When capitalized, Sie means " you" in the singular.
But here the focus is the singular form of “you”, which in German can be expressed as “du” or "Sie”.
Broadly speaking, du is used when speaking to or with
• children (up to about 15)
• animals and inanimate objects
• good friends
• all schoolchildren and students
• fellow workers (blue collar, not white collar)
• non-commissioned officers
• members of some clubs, interest groups, or political parties (in particular, left-leaning)
In all other situations, you use sie. In particular, Sie is always used with adult strangers, and generally among white-collar colleagues in an office, bank, or other professional environment. Police in Germany are required to use sie all the time, even when talking to a criminal caught in the act of burglary, arson, or worse. Failure to do so results in a fine. German police have to use polite pronoun no matter what.
Using du inappropriately can sound too familiar and friendly. It can even be condescending or patronizing, and can be used to signal contempt, a lack of respect, or outright rudeness. You can actually offend people very easily if you use du when you should have used sie.
On the other hand, using sie inappropriately can sound pompous, haughty, and even arrogant. This dichotomy does not exist in English, and should not be confused with the tu versus vous or the tú versus Ud. distinction in French and Spanish respectively. Each of these languages has its own ideas and requirements about when to you these pronouns.
There are some ongoing shifts in the usage patterns for du and sie. Because du signals intimacy, solidarity, and affect, younger people tend to use it. It is also used more readily in south of Germany and Switzerland. But this trend is weakening, and du is not nearly as common or acceptable as the use of first names is in the U.S., Canada, or Britain. Sie is still quite common in office environments.
Sie is also associated with formal titles. Someone you would address as Frau Winter, Herr Schmidt, or with a title like Professor or Doktor is someone you would use the pronoun Sie, and never du, with. The shift to du typically involves a corresponding shift to using first names.
Also, interestingly, du is used more often when talking to someone of the same sex as compared to someone of the opposite sex. But everyone agrees that in emergency situations du is the pronoun of choice, perhaps because fires, floods, and such are hardly the time for social niceties.
There is one more trick to know: ihr is more than just the plural of du. It can be used when speaking to any group of people even if you would address individuals in the group with sie. It makes a nice compromise between sie and du when you are not certain which would be appropriate.
Germans are fairly forgiving with foreigners learning their language. Unlike the French, who can be intolerant of mistakes, Germans are much more likely to help you along and provide useful guidance. But the better your accent, the more German you sound, the more likely an inappropriate use of du or sie will cause confusion or offense. It’s best to learn the distinction well as soon as possible, and follow the lead of the people around you if you are unsure.