I’ve fielded that question many times, usually after someone has sampled an especially resinous IPA — although at least one PopSci editor asked me the same question when looking at a photo of the leaves of a hop plant.
The fact that both Humulus lupulus (hops) and Cannabis sativa (marijuana) have similar organoleptic properties (taste and smell) could indicate a common ancestry–but it isn’t proof. Lots of plants make similar aroma molecules, known as terpenes and terpenoid compounds, including lemons (which make limonene), lavender (linalool) and conifers (pinene) — but none of them are closely related to cannabis or hops.
Terpenes are a class of organic compounds synthesized by cells. They all start with a particular base molecule, called isoprene. I won’t go into terpene biosynthesis here, but it’s important to remember that all terpenes are built up using one or more copies of isoprene. A few of the primary aroma terpenes in hops are myrcene, beta-pinene and alpha-humulene–these and similar aromatic compounds are also what give cannabis plants their characteristic smell.