I have a 7 hour layover in Gatwick and I wanted to explore the city during that time. I have a US passport if that helps.
With a US passport, you can enter the UK without a visa (for up to 180 days--well more than your 7-hour stay), so that's no problem.
The problem will be that Gatwick is far from the city. Fortunately, the Gatwick Express makes transportation into the city fairly easy, and you can buy a round-trip ticket starting around £31.05. The trip to Victoria Station will take a bit more than half an hour. There are cheaper ways to get from Gatwick to the center of London, but they will take longer. Whether time or money is more valuable to you is a personal preference. From Victoria station, it's another 15 minutes or so, by metro or bus, into the city center.
I would budget a minimum of 1 hour each direction (so 2 hours round-trip) if you're using public transportation, plus about £40 for public transportation (Gatwick Express + tube/bus in the city).
With that, you should arrive back to Gatwick, to clear security and find your gate, about 2 hours before your departure. Leaving the airport will also take a minimum of 30 minutes (to deplane, claim luggage if applicable, etc). So that would leave 2-3 hours in the city to do sight-seeing.
It is, of course, up to you whether £40 for transportation is worth it for this amount of time in the city.
As flimzy pointed out, it's going to take a while to get through the airport and to and from London. In my opinion, spending about 40 pounds to see a glimpse of london for 2-3 hours really isn't worth it. Remember that the parts you want to see may be quite a way from London Victoria and London Bridge stations. Getting to London bridge is sometimes actually quicker, but it's not a particularly nice part of london. (the bridge everyone wants to see is Tower bridge, not London bridge)
You would be better off going in the other direction, to the coastal city of Brighton. It's about the same time away by train, even though it's much quicker by car. The train ticket is cheaper and everything is within walking distance of the station. It's famous for its (pebbly) beach, Pier and Pavilion, and has a wonderful secondhand market / Bohemian area in North Laine which is as good as any in London (and probably cheaper.)
The official UK railway site is www.nationalrail.co.uk
Here's a sample set of times/fares for tomorrow afternoon OFF PEAK for the three destinations from Gatwick mentioned in this answer. Peak services will be more expensive, especially in London.
Victoria 30min / 26.50GBP (Express service) or 31-42min / 15.40GBP (stopping service) London Bridge 29-74min / 11GBP Brighton 31-36min / 9.50GBP
I was the only one to mention London Bridge, though I dismissed it in favour of Brighton. As people have pointed out in the comments, the London Bridge area does have some things to offer, but I still think Brighton is the best choice. If you travel regularly, London's opportunity will come soon, and hopefully you will have time to do it justice.
Yes, US citizens are welcome to enter the UK without advance notice.
When you arrive at Gatwick, simply follow the signs for "Arrivals" / "Passport control" / "Baggage claim" / "Exit".
Do not follow the purple signs for Flight Connections. Once you enter the departure area after security, it is not easy to leave again.
Your luggage (if you have any) will be checked through automatically (unless you are advised otherwise at check in), you will not be able to collect it. When you return to Gatwick, you may need to visit a check in counter to collect your onward boarding pass, if you were not issued it at your outbound station.
There is no problem doing this, it is not unusual. If you have checked-in luggage, you may wish to present your baggage receipt to ensure it gets linked to the new check in record.
OK, the other answers have addressed the visa issue - which is fine - I'm going to add a warning and a suggestion.
The warning first: it's not likely, but if there were some critical incident or failure on the public transport system then you might be unable to get back to Gatwick in time. Travel time from central London to Gatwick by car is over an hour without traffic - if the rail system were having problems then this could easily lengthen to 2 hours due to knock-on congestion. It's not likely to happen, and depending on the flexibility of your ticket it might not matter, but something to bear in mind.
Now the suggestion: get the train from Gatwick to Waterloo changing at Clapham Junction. This takes about 50 minutes:
The advantage is that Waterloo station is right next to the London Eye, which is just about the best way to see a big chunk of London sights in one go. Pre-book your ticket as the queues can be a problem. You get a great view of Parliament and Westminster Abbey in one direction and in the other direction a view across to the City (the financial centre) and Docklands (the other financial centre) ie skyscrapers. You can see most of London's really well-known buildings from the Eye.
Then if you have time you can walk across the Thames over the footbridge next to the London Eye, and that gives you great views as you're doing it, and then on the other side you're 10 mins walk from Trafalgar Square (Nelson's Column, National Gallery), near to 10 Downing St and Horseguards Parade; if you go really fast you might have time for Churchill's War Rooms (WWII command bunker).
Going into London, at Clapham Junction: get the first train from platform 4, they all go to London Waterloo. Train every 5 or 10 mins.
Going back to the airport, at Waterloo: get the first train from platforms 1-4, they all go to Clapham Junction. At Clapham Junction: change to platform 13 and wait for a train where the electronic display board on the platform shows "Gatwick Airport" as one of the stops. They're at about 15 min intervals.