Colloquial meanings of the two words are pretty close, accidental is "occurring unexpectedly or by chance", contingent is "subject to chance; occurring or existing only if (certain circumstances) are the case; dependent on". If there is a shade of difference, it is that contingent may well be expected as a possibility, albeit along other options, whereas accidental is something more of a "completely" unexpected. A coin landing on either heads or tails are "contingent" events, while landing on an edge is a "freak accident". But colloquial usage does not follow strict rules or suffers precise definitions.
But in philosophy they are used in different contexts, and in opposing pairs: essential/accidental, necessary/contingent. "Essential" applies to properties of objects that makes them what they are, indispensable to them. The rest are accidental, The terminology goes back to Aristotle, and was revived in modern times by Kripke, see SEP, Essential vs. Accidental Properties. The distinction is controversial. We would normally say that being a man is essential to a man, and having a scar isn't, but it is unclear if this has significance independent of personal or cultural context, some might consider their scars essential to who they are.
Essential properties are those that an object would presumably have in all possible worlds where it exists at all. Necessary must be present in all possible worlds, period. That is Kripke's modern distinction in modal logic, see Kripke on the necessary a posteriori by Speaks. Contingent is that which is neither necessary nor impossible, something that is lacking in some possible worlds and present in others. Also, while essential/accidental is usually applied to properties (or relations), necessary/contingent is usually applied to propositions. So the essential is closely aligned to the necessary, and accidental to the contingent, although essential properties can be, strictly speaking, contingent, if their object is itself contingent.