How to set meta title, keywords, description and page title for a page programmatically in magento 2?

You can set Page Title and Page Browser Title separately using Magento 2.
If you want to set Different Page title and browser tab title you need to do using programmatically.

You can do it via Either Block prepareLayout() function or Controller execute() function.

You can set custom Page Title, Meta Title, Meta Description, Meta Keywords for any page using programmatically.

The priority of display Meta Title, Keywords, Description.
1. XML file
2. Block prepareLayout()
3. Controller execute()
4. i18n
Priority with the highest number overrides the value of the lowest number from the given hierarchy.

if i18n CSV file has translation keywords available, All the old keywords from, whether XML, Block or Controller, override with  i18n CSV file.

For Set Page title and Page Browser title using Magento 2, Via Block File,

<?php
namespace Rbj\CustomTitle\Block;

class MetaTitle extends \Magento\Framework\View\Element\Template
{
	public function __construct(
		\Magento\Framework\View\Element\Template $context,
		\Magento\Framework\View\Page\Config $pageConfig
		array $data = []
	) {
        $this->pageConfig = $pageConfig;
        parent::__construct($context, $data);
    }

    /**
     * @return $this
     */
    protected function _prepareLayout()
    {
        $this->pageConfig->getTitle()->set(__('Account Information | Site Name')); // browser tab title
        $this->pageConfig->setKeywords(__('meta keywords goes here.')); // meta keywords
        $this->pageConfig->setDescription(__('meta description goes here.')); // meta description

        $pageMainTitle = $this->getLayout()->getBlock('page.main.title');
        if ($pageMainTitle) {
            $pageMainTitle->setPageTitle(__('Account Information')); // Page <H1> Main title
        }
        return $this;
    }
}

Using Controller,
Create Controller file in your module at Path, app/code/<PACKAGE_NAME>/<MODULE_NAME>/Controller/Controller.php

<?php
namespace Rbj\Customer\Controller\Account;

class Metawords extends \Magento\Framework\App\Action\Action
{
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
        parent::__construct($context);
    }

    /**
     *
     * @return \Magento\Framework\View\Result\Page
     */
    public function execute()
    {
        /** @var \Magento\Framework\View\Result\Page $resultPage */
        $resultPage = $this->resultPageFactory->create();

        $resultPage->getConfig()->getTitle()->set(__('Account Information | Site name')); // browser tab title
        $resultPage->getConfig()->setKeywords(__('meta keywords goes here')); // meta keywords
        $resultPage->getConfig()->setDescription(__('meta description goes here.')); //meta description

        $pageMainTitle = $resultPage->getLayout()->getBlock('page.main.title');
        if ($pageMainTitle) {
            $pageMainTitle->setPageTitle(__('Account Information')); // Page H1 title
        }
        return $resultPage;
    }
}

Using the above way you can set custom meta keywords, meta description, meta title, and Page H1 title.