D&D orcs aren't related to elves, but it varies by campaign setting.
The origins of the orcs varies between campaign settings and sources, but it is most commonly asserted that they were simply created by Gruumsh, primary deity of the orcs in many worlds.
Unlike in Tolkien's works, D&D's orcs are not derived from elves. Gygax was eager to distance the game from Tolkien's lore after a lawsuit, which also saw D&D change "hobbit" to "halfling" and a few other changes.
According to the article "The Gods of the Orcs" from Dragon magazine #62 (p. 28), orc shamans tell that long ago, the gods of each race drew lots to determine the terrain in which their people should live. Gruumsh was cheated out of any home for the orcs, and in response declared that his race should forever conquer the lands of other races. The orcs thus came into the world, though it is not specifically stated here how they were created. The AD&D 2e book Monster Mythology concurs with this view.
The D&D 5th edition Monster Manual p. 244-245, follows on from this story and defines that Gruumsh is very specifically the creator of the orcs. This is a surprisingly rare assertion; most sourcebooks only state that Gruumsh is primary god which most orcs worship.
The Complete Book of Elves p. 9-10 gives a description in a story which, like most prehistoric origin stories of races in D&D, is considered only an approximation of the truth, and may be contradicted by other myths. In this version of events, Gruumsh became enraged after seeing the first elves, and tried to destroy them, leading to a fight in which the elven god Corellon put out Gruumsh's eye. Gruumsh fled and created the orcs from his burning hatred and blood, for the purpose of one day destroying the elves. Thereafter the elves were infused with Corellon's blood, and other deities created the other common races in imitation of the elves.
A possible alternative appears in Lords of Madness p. 26-27, where it is described that the primal aboleths, created by an Cthulhuesque elder entity millions of years ago, decided themselves to create forms of life with which to populate the world. Among their creations were humanoids, who may have been the ancestors of current-day orcs. It is speculated that, through the power of faith alone, these humanoids called deities into being, and these gods destroyed the aboleths' planetary empire.
Mystara: According to the 1988 D&D sourcebook The Orcs of Thar (GAZ10), set in the Known World setting, the souls of evil or chaotic beings were reincarnated into the world long ago as "beastmen" to atone for their sins. These beings were the ancestors of the orcs and goblins. This origin story doesn't occur in other D&D settings.
Forgotten Realms: The 3.5e book Grand History of the Realms notes that the orcs existed around 24,400 DR, but does not define their creation. The generic lore generally applies to this setting, and Gruumsh is a deity in Faerûn.
Eberron: According to the original Eberron Campaign Setting, the orc nations arose some 30,000 years ago on the continent of Khorvaire. The origin of the orcs is not stated.
Greyhawk: The Scarlet Brotherhood p.68 describes that orcs have existed since ancient times, when they took part in a war between red dragons and fire giants in the Hellfurnaces mountain range, a war which also involved the human Suel Imperium. They were later employed by the Suel as mercenaries, and spread into the Flanaess along with several human groups during the Great Migrations. However, the orcs' creation is not documented. The generic lore (excepting D&D 4e and the non-AD&D Known World material) usually applies to this setting. It's not impossible that they were actually bred by the Suel Imperium as a warrior race (they bred the Derro this way, and in recent times the Scarlet Brotherhood have bred the kimazar, kurg and rullhow), but that would be speculation.
Side-note on alignment
It's worth noting that in D&D 3.5's Monster Manual, orcs are not inherently evil. Orcs are listed there as "often chaotic evil", with "often" being a game term defined as around 40-50% of creatures having that alignment, which they may acquire through nature or nurture. It's not specified how much of the orc's alignment comes from "genetics" and how much is social; there is precedent for the latter case, in that settlements in 3.5 have prevailing alignments, and the existence of predominantly evil cities or nations of humans are well-documented.
The "often/usually/always" keyword is omitted in 5e monster statblocks, creating the sense that all orcs are of the same alignment. Officially (per MM p. 7), the listed alignment is only the default. Orcs could always be non-evil in 5e; they just tend to be chaotic evil.
The AD&D 2e Monstrous Manual, p.282, notes:
Orcs have a reputation for cruelty that is deserved, but humans are just as capable of evil as orcs.