I created a div tag like this:
System.Web.UI.HtmlControls.HtmlGenericControl dynDiv = new System.Web.UI.HtmlControls.HtmlGenericControl(\"DIV\");
Alternative approach if you want to add a class to an existing list of classes of an element:
element.Attributes["class"] += " myCssClass";