SAN FRANCISCO—In 2013, Medivation Inc., a San Francisco-based pharmaceutical firm, “woke up” to find it was competing with Johnson & Johnson.

That’s how the company’s lawyer described the effect of his client’s dispute with UCLA chemistry professor Michael Jung over the rightful ownership of chemical compounds used to treat prostate cancer.