They are extracted and re-embedded in the DOCX where the format supports embedding. Formats that reference rather than embed (HTML, Markdown) get the images written alongside and linked, so keep the files together when you move them.
Are tables preserved when converting HTML to DOCX?