We recommend you to check the available documentation to transform HTML to Word:
https://www.phpdocx.com/documentation/introduction/html-extended-to-word-PHP (HTML Extended is only available in Premium licenses)
You are adding a div tag, and by default, phpdocx handles div tags as containers (from the previous documentation pages):
div: Although this tag is probably the most frequent in modern HTML code, it does not have a direct translation into Word. phpdocx offers different parsing options:
Only use it for the CSS inheritance and parse consequently its child elements.
Parse them as a "p" element with the option "parseDivs" set to "paragraph" (this may be an useful option when using HTML code coming from a WYSIWYG editor).
Parse it as a table with the option "parseDivs" set to "table". This may be the most accurate option if one may decide to preserve all available formatting but may produce complicated Word documents that may be later difficult to edit manually (if that is an interesting option).
So if you want to use div tags as paragraph tags, you need to use the parseDivs option (or change them to p tags):
$html = '<div style="padding: 30px 40px; background-color: yellow">Test docx</div>';
$docx->embedHTML($html, array('parseDivs' => 'paragraph'));
$html = '<p style="padding: 30px 40px; background-color: yellow">Test docx</p>';
Also please note that not all CSS styles have a direct translation to MS Word. For example, MS Word doesn't allow setting paddings to run-of-text contents (such as inline texts), only to block elements such as paragraphs or tables; to add spaces to run-of-text tags you'd need to add blank spaces as MS Word does (or tabs but these elements only supported in Premium licenses when transforming HTML).