San Diego's climate is famously even — daytime highs in the upper 60s in winter, mid 70s in summer, and rain almost entirely confined to December through March. There's no bad time to visit, but timing affects what you'll get.
June can disappoint beach-seekers. The marine layer (the locals call it "May Gray" and "June Gloom") parks itself over the coast, and the sun can fail to break through until afternoon. The water is also still cold — around 64°F (18°C). August and September are the warmest months, with water temperatures rising to a swimmable 70–72°F (21–22°C); the marine layer largely lifts.
Spring (March–May) and autumn (October–November) are the sweet spots: warm enough for the beach, cool enough for hiking, hotel prices below summer peak. Winter is mild and often clear, ideal for whale-watching tours (Pacific gray whales pass close to shore from December to April).
The big calendar event is Comic-Con International in mid-July — 130,000 attendees take over downtown and lock up every hotel in the city. Avoid that week unless you're going.