You don't have as much free time as you think! The general rule of thumb is to allow five hours--or longer--between scheduled arrival at one London airport and scheduled departure from another. However, people report that when all goes perfectly, they've made the Heathrow-Gatwick transfer in around four hours.
But you MIGHT have time for a very quick stop in central London. Buy a one-day travelcard for zones 1-6, take the tube to Victoria rail station, stow your luggage there, and take the tube to Westminister, emerging across the street from the Parliament building. Take a short walk and then take the tube back to Victoria. Take a Southern train (cheaper than the Gatwick Express and only ten minutes slower) to the airport. Allow one hour for your tube ride from Heathrow to Victoria and 40 minutes for the Southern train to Gatwick. Go to www.tfl.gov.uk to download and print a tube map.