Your best option is to take a bus from Marbella to La Línea de la Concepción.(you can look at times and fares, as well as buy your tickets in advance here). At Línea de la Concepción, you pass the border (remember to take your passport) and you’re in Gibraltar!
At Gibraltar, you can go on the tour of the rock, visit St. Michael's Cave, the Siege Tunnels, the Pillars of Hercules and of course the “Queen’s Gate”, where the monkeys are. (don’t feed them!!). The Barbary macaque monkeys you see in Gibraltar are the the only wild monkey found anywhere in Europe. These monkeys predates British occupation and are said to have bought there by Moorish rulers.
Instead of reaching Gibraltar, you could also drive down to Línea de la Concepción from Marbella. However, the lines at the border can be long. Often, visitors who drive down to Gibraltar park their car at Línea de la Concepción and walk across. It is not that only tourists visit Gibraltar. The local residents go there to buy tobacco, chocolate and more because it is cheaper at Gibraltar.
I would recommend travel by bus to Gibraltar over driving down to Gibraltar. Once at Gibraltar, you can sign up for one of the tours offered by local operators. I have used this tour company in the past.
Some good restaurants in Gibraltar are Gatsby’s (offer a variety of dishes from different cultures), Verdi Verdi (Moroccan influence), Jumpers Wheel (fish, spanish tapas...) or Lord Nelson (fish and chips.