I'd recommend Santa Cruz as a beach town, and I would also suggest that the Henry Cowell Redwoods State Park is a great diversion that both you and your child would appreciate. Anywhere further south would also be taking you further away from Yosemite.
Monterey is not too much further south, and as noted above, the Aquarium is great for an intellectually curious child.