Disable autofill username & password on drupal
Auto-completion of common fields (text, password, select, textarea, date-related, time-related, numeric, email, and uri controls) is a browser feature but you can tell browsers to turn off auto-completion on form fields by using the autocomplete attribute.

You can use hook_form_alter or hook_form_FORM_ID_alter to add this attribute to your fields.

Example:

/**
 * Implements hook_form_alter().
 */
function example_form_alter(&amp;$form, $form_state, $form_id) {
  if ($form_id == 'YOUR_FORM_ID') {
    $form['YOUR_FIELD']['#attributes']['autocomplete'] = 'off';
  }
}


Example altering the log-in forms:

function example_form_alter(&amp;$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'user_login_block': // Log-in block form.
    case 'user_login': // Log-in form.
      // Username
      $form['name']['#attributes']['autocomplete'] = 'off';

      // Password
      $form['pass']['#attributes']['autocomplete'] = 'off';
      break;
  }
}


You can check out these posts for more info on module development - Module Developer's Guide and Creating Drupal 7.x modules. You can also download the excellent Examples module for reference.