There are two baseline factors.
- Water solubility.
- Lipid membrane permeability.
We need a drug to be water soluble to dissolve in the stomach.
BUT
We also need it to be fat (lipid) soluble to "float" through the gut lining and into the blood (unless there is a transporter it can hijack).
You may notice that we want both water and fat soluble.
Things that are say like salt or sugar dissolve easily in water, but ever tried to dissolve them in oil?
Similarly things like chewing gum won't dissolve in water, but will dissolve in oil (fast into orange oil gum remover for example).
Given these two almost opposite requirements only about 30% of medications have this physical characteristic. Basically they have a polar (water loving) and non polar (lipid loving) part. Technically hydrophilic (water loving) and hydrophobic (water hating, oil loving) parts.
In day to day life dish washing detergent and alcohol are two common things that have this dual nature.
BCS class I chemicals are water soluble and permeable (detergant, alcohol)
BCS class II chemicals are relatively insoluble but permeable (oily)
BSC class III chemicals are soluble but relatively impermeable (salty)
And BCS class IV chemicals a insoluble and impermeable (ie like sand or rock)
Velpatasvir is BCS class IV.