WordPress may some time ask FTP Credentials while Installing or Upgrade Plugins or even the core WordPress.
The issue is due to the reason that, while be try to perform the action WordPress will first checks whether it has the permission to access the file system directly.
If it does not have the necessary permissions to modify the filesystem , it will ask you for the FTP credentials so that WordPress can try to do what it needs to via FTP.
This issue can be resolved by adding the following code in the wp-config.php file in the root folder.
define( 'FS_METHOD', 'direct' );
define( 'FS_CHMOD_DIR', 0777 );
define( 'FS_CHMOD_FILE', 0777 );
Now the WordPress will have the permissions to modify the filesystem directly.