With the XML file in Magento 2, you can place CMS blocks at any position on the page and manage page layout. Inserting a widget into the sidebar can be done with two elements: set up a widget and set up a layout update.
How to Insert a Widget into Sidebar in Magento 2:
Set up a Widget: Widget is the powerful functionality of Magento 2 which can contain static or dynamic content at the storefront to improve user experience. Links for category page, product page, or content page can be added to a widget.
Step 1: From the admin panel, navigate to Content > Elements > Widgets
Step 2: Click the Add Widget button available in the upper-right corner.
Step 3: Under the Settings option:
In the Type field, select CMS Static Block.
In the Design Theme field, choose the present theme.
For more details checkout: How to Insert a Widget into Sidebar in Magento 2