The first is the Covenant Name of Hashem (YHWH), which is traditionally not pronounced. Hundreds of years ago, the Masoretes gave us “ketiv qere” indicators to tell us what words to substitute for the Covenant Name (aka “tetragrammaton“). “Ketiv qere” means “written (differently than) read.”
When the niqqudot (vowel points) from the title “Adonai” (L-RD) are placed under the Name, it is traditionally read “Adonai“ instead of attempting to pronounce YHWH and guessing at what vowels go there; and when the niqqudot from the title “Elohim” (G-D) are present, we substitute “Elohim“ for the tetragrammaton. We do this out of reverence for the Holy One, blessed be He, and in obedience to the 3rd Commandment of the Decalogue: “You are not to take up the name of YHWH your God for emptiness, for YHWH will not clear him that takes up His name for emptiness” (Shemot/Exodus 20:7 TSB*). For another nuance to this discussion, see Prof. Brian Tice’s article on the historical use of nominae sacrae.
In many of our prayers, we here the juxtaposition of two titles of Hashem: “Adonai Eloheinu” (L-RD our G-D). It has been observed that in their contextual usage, the tetragrammaton appears in Scripture when the 13 attributes of mercy are being emphasized (grace, mercy, compassion, etc.), and the title Elohim (the lexical form from which Eloheinu comes) is used when the attributes of Judge and Creator are in view. When both are used in conjunction, both sets of attributes are in view.**
*TSB = Everett Fox, The Schocken Bible: The Five Books of Moses (New York: Schocken Books, 1995; used with permission). This translation was chosen for its diligence in preserving not only the literal meaning of the Hebrew text, but also the original rhythm of the text. It is a masterful translation, and highly recommended.