Hi,
You can achieve same using JavaScript and in JavaScript add condition to check the two option set field value if it is yes then run below code.
// define the data
var data =
{
"subject": "Sample task",
"description": "Some sample data",
"regardingobjectid_opportunity@odata.bind":"/opportunities(GUID)"
}
// create account record
Xrm.WebApi.createRecord("task", data).then(
function success(result) {
console.log("Task created with ID: " result.id);
// perform operations on record creation
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
When we set the regarding object id value then task will automatically appear in Timeline for respective entity as shown below:

You can achieve same by using Workflow:
In workflow tick the Field Change and Record Created property and add Check condition if two option set field value is yes then create task as shown below:

same functionality you can achieve through plugin as well as Power Automate.
Thanks,
Pradeep.
Please mark this as VERIFIED it it helps.