Insert data in custom table during new post creation

You hook a function to save_post (for saves and updates) or publish_post for publication only. The second hook is really a variable hook of the form {$new_status}_{$post->post_type} so it will be different if you aren’t dealing with a post post type.

function do_on_publish_wpse_98177($id) {
  // your code; $id is the post ID
}
add_action('publish_post','do_on_publish_wpse_98177');

Make backups and test thoroughly on a development server. It is easy to break things with these hooks.

You can use $id to pull information from the database including category information. You can also access the global $_POST if you need it but these hooks run after the post save so if something has altered (another function) the data saved to the database $_POST might be out of sync.

See also:

http://codex.wordpress.org/Post_Status_Transitions