I think four hours is too tight to be able to take the train or bus to anywhere scenic. I've been in Osaka twice the past few months. Of course it depends on the destination, but often busses run once an hour to the major hotels. The train runs every 30 minutes to Kyoto (which is 70 minutes away). There are interesting sights in Osaka - the Castle, the Observatory, the Aquarium - but 4 hours simply doesn't allow enough time to wait for transportation, then the transit time, sightseeing time, and return to the airport.
(Yes, there is a luggage storage area at the airport.)