Let’s break down the Latin.
Deus noun for “God”; ex preposition for “from”; machina noun for “machine”
Latin does not have the articles, a, an, or the, so one must add them. In this case, English follows German, not Latin.
Deus ex machina is a noun phrase translated as, “God from the machine”.
It is a device that has been around since the time of ancient Greek theater. The playwright Euripides (484-406 B.C.) popularized the technique.
In modern usage, it has turned into this: an unexpected power or event saving a seemingly hopeless situation, especially a contrived plot in a play or novel.
One Pixar rule: coincidences to get characters into trouble are great; coincidences to get them out of it are cheating.