DesiredCapabilities is a class in org.openqa.selenium.remote.DesiredCapabilities package used for setting the properties of a browser such as BrowserName, Platform, Version of Browser, etc. A typical usecase would be to set the path of FirefoxDriver for testing. DesiredCapabilities class is also used when we need to use Selenium Grid for executing mutiple TestCases on multiple Systems with diff browsers, and diff versions and diff OSs.
Example:-
// To Create a new object of DesiredCapabilities class.
DesiredCapabilities capabilities = new DesiredCapabilities();
// To set the android deviceName desiredcapability.
capabilities.setCapability("deviceName", "your Device Name");
// To set the BROWSER_NAME desiredcapability.
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
// To set the android VERSION desiredcapability.
capabilities.setCapability(CapabilityType.VERSION, "5.1");
// To set the android platformName desired capability.
capabilities.setCapability("platformName", "Android");