This holds due to a change of measure. There is the real-world $\mathbb{P}$ and the risk-neutral world $\mathbb{Q}$. (I am going to assume constant interest rate $r$)
The first fundamental theorem of asset pricing states that if there are no arbitrage strategies in a market, then there exists at least one probability measure $\mathbb{Q}\sim\mathbb{P}$ such that discounted stock prices $(S_te^{-rt})$ are $\mathbb{Q}$-martingales, i.e. for any $T\geq t$, we have $$\mathbb{E}^\mathbb{Q}[S_Te^{-rT}\mid\mathcal{F}_t]=S_te^{-rt}.$$ We can then show that the value process of any admissible claim is alslo a $\mathbb{Q}$-martingale. The value process of a derivative with terminal payoff $V_T$ is simply the discounted payoff, i.e. $V_t^\mathbb{Q}=\mathbb{E}^\mathbb{Q}[V_T\mid\mathcal{F}_t]$ (some authors define the value process directly as conditional expectation of the discounted payoff). This means $$V_t^\mathbb{Q}= e^{-r(T-t)} \mathbb{E}^\mathbb{Q}[V_T].$$
For example, consider a vanilla call option and set $t=0$. You obtain $$\mathrm{Call} =e^{-rT}\cdot \mathbb{E}^\mathbb{Q}[\max\{S_T-K,0\}].$$
So, in order to price the call option, you only need to compute this expectation in the risk-neutral world.
The second question is about the distribution of $(S_t)$ under $\mathbb{P}$ and $\mathbb{Q}$. You need the latter in order to compute the expectation above. Black and Scholes (1973) assume that the stock price follows a geometric Brownian motion $$\mathrm{d}S_t=\mu S_t \mathrm{d}t+\sigma S_t\mathrm{d}W_t.$$ To switch from $\mathbb{P}$ to $\mathbb{Q}$, you need to change the drift $\mu$. The volatility $\sigma$ remains the same. This follows from Girsanov's Theorem. It turns out that you change $\mu$ (under $\mathbb{P}$) to $r$ (under $\mathbb{Q}$). Remember that all stocks have return $r$ since no one pays you a premium for risk. Thus, in the risk-neutral world, the price follows $$\mathrm{d}S_t=r S_t \mathrm{d}t+\sigma S_t\mathrm{d}W_t.$$ You can solve this SDE with Ito's Lemma to get a geometric Brownian motion. This process is for each time point log-normally distributed. Using this distribution, you can compute the above expectation and you will arrive at the solution from Black and Scholes (1973).
Risk-neutral pricing, i.e. finding derivatives prices as expectation of discouned payoffs in the risk-neutral world is a super powerful tool :)