Many people are being surprised by Windows 10 doing the upgrade when they have click the X to cancel the pop up window.
However, Microsoft has changed Windows 10 to a recommended update, which will install automatically, if you don’t know what settings to change to prevent it.
To make it simple, I would recommend this free utility, Never10, from Gibson Research that prevents Windows 10 from installing.
If it is too late and Windows 10 has already started installing, and you don’t want it, when it gets to the question about accepting the license, refuse the license and it will roll back.
If you accepted the license, you can use the Restore Point created by the Windows 10 upgrade to go back to your prior version of Windows.
You can search Google for how to handle any of the above topics.