All contests are competitions but not all competitions are contests.
In the majority of situations, you can use either term. You’ll rarely be wrong. However, to answer your question, competition is a broader term than contest.
In a contest, a person or team competes for a prize (or recognition). Personally, I might prefer this term if only one skill were being tested, like a pie eating contest, although competition also works well in that context.
Imagine, however, a broader concept, less precise regarding the specific skill being tested. An office, school or family might be a competitive environment, and the workers, students or siblings might feel like they’re in a competition. I probably wouldn’t use contest in that context.
Again, I’d say there’s very little practical difference in most situations.