Both are classes of SharePoint Server side object model. Under SharePoint web application, you can have multiple site collections and under a site collection you can have multiple sites/subsites. To access/update site collection properties, object of SPSite class is used. And to access/update root site of site collction or sub site properties, object of SPWeb class is used.