Thanks for the added details.
Does this happen when using other Photoshop tools?
Like the selection tool, or eraser; does it switch to another tool or eyedropper?
Something to try with Photoshop, is resetting Preferences -
While holding down the Command + Option + Shift keys, then click on Photoshop Icon to start.
When it’s starting up, Photoshop will show a dialog box, asking to delete the Adobe Photoshop Settings File.
Select Yes, and it will reset all your Photoshop settings.