1. How to approve list item from your code
In order to approve list item from your code you need to need to modify list item's moderation status using following line
Item.ModerationInformation.Status = SPModerationStatusType.Approved
Where Item is your list item
2. In order to start workflow automatically on item publishing event
You need to select following option while associating custom workflow with your list
"Start this workflow to approve publishing a major version of an item"
You may not find this option with your custom work flow if you haven't placed following configuration in your wokflow meta data while defining work flow.
<Workflow .... .> .......... <MetaData> <InitiationType>
</InitiationType> </MetaData> </Workflow>