The compass was invented accidentally, but it was used for several things. The Chinese used the compass for Chi which was the study of the magnetic force around the earth. When the Germans heard about the compass, they used it for sailing because they saw the productive use of the compass.
The Chinese were so invested in trying to control Chi that they did not see the other way to use the compass. Now, on the other hand, the Germans did not study Chi and saw they could use the compass for sailing.
Back then the sailing season ended in winter and did not pick back up until spring because it was so cloudy in the winter. With the compass, the sailing season could be extended all year around which prompted more trades with foreign countries. The Chinese are different from the Germans because the Chinese spent most of their time trying to control Chi while the Germans saw they could use the compass for sailing therefore increasing their capital.
So as one can see, the compass was used for several different things, but now it is used for sailing and navigational purposes.