Blackbeard is one of the most intriguing characters from One Piece with his origins being one of the most speculated theories. While every fan has a different view of whom his parents might be, there is no telling from whom he got his D. However, while his connection with Xebec might be legitimate, the D he got might be from his mother's side, just like Ace.
It all goes back to the time Nefertari D Lili escaped the First Twenty and might have resided on Amazon Lily to stay hidden. Gloriosa might be Lili's descendant and her being a part of the Rocks Pirate makes her relationship with Xebec more obvious. Although Blackbeard got his name from Xebec's sword, Teech, he got his D from Gloriosa who was a descendant of Lili.
Disclaimer: This article contains potential spoilers from the One Piece manga series and has the author's opinion.
One Piece: Exploring the origins of Marshall D Teech

Marshall D Teech, more commonly referred to as Blackbeard is one of the Four Emperors of the Sea and the only confirmed pirate who is capable of using more than one devil fruit. Other than his mysterious powers, his origins are no different because him being a D clan member is one of the most controversial aspects of One Piece.
While the fandom thinks that he got the 'D' from his speculated father (Rocks D Xebec), things might be quite different and it all goes way back when the World Government existed as the First Twenty. During this time, the First Twenty waged war against the Ancient Kingdom (the Void Century War) and the key aspect of this war might be Nefertari D Lili.

Lili, just like her descendant Vivi, was a dual agent as she was part of the First Twenty and was also responsible for spreading the Poneglyphs (helping the Ancient Kingdom). The reason behind this might be that she was betrayed by Nerona Imu (Imu) and she left the First Twenty after this. Lili might also be pregnant with Imu's child (the reason why Imu is still referred to as 'they').
With every island in reach of the First Twenty, the only place Lili could reside was Amazon Lily, which stood in the middle of the Calm Bet. Here, she stayed hidden and gave birth to her child. Imu might have also cursed Lili to never fall in love which created the 'lovesickness curse' that led to the death of various Empresses on Amazon Lily.

Lili's generation continued after her death and reached Gloriosa who might have given birth to Blackbeard. This was evident because she was a part of the Rocks Pirates (linking her to Rocks D Xebec). However, during the God Valley Incident, she might have left her son on Amazon Lily and joined the Rocks Pirates.
During this time, Blackbeard was mishandled by the woman at Amazon Lily and he was thrown out after which he met Whitebeard on an island. Moreover, Blackbeard might have also gotten his name 'Teech' from Xebec's sword.
However, due to the sudden death of his father, he later learned of her mother and added 'Marshall D' to his name, just like Ace (Ace was named after Roger's sword 'Ace' and was named Portgas D Ace instead of Gol D Ace).
Analysis and Final Thoughts
Just like every theory, there are a lot of things to consider with the prime one being why didn't Gloriosa stop Blackbeard when he was about to kill Boa Hancock. Being the previous Pirate Empress, she had the duty to defend the current one from danger, but she might have been overcome by her kindness as a mother. However, as Oda has kept his tabs on so much, this theory might be the best one for Marshall D Teech's origins.
Related Links
- Blackbeard may be a member of One Piece's most exclusive club
- Everything One Piece fans know about the Blackbeard Pirates
- One Piece: Is Blackbeard the son of Rocks D. Xebec?
- One Piece chapter 1107: Is Blackbeard a Buccaneer? Explored