There are third-party libraries to help, but if you want to develop a solution yourself, you may want to get hold of the Open XML SDK.
I recommend that rather than creating a Word document completely in code, you create a template document using Microsoft Word and then modify it using the Open XML SDK.
Don't be tempted to use Word Automation if you're producing the document on a server. Apart from being unsupported, it's somewhat prone to resource issues.
I blogged some time ago about inserting images into Word documents using Open XML.