I know that for a metric space $(X,d)$ we can define a new metric $\text{dist}_{l}$ on $X$, where $\text{dist}_{l}(x,y)$ is the infimum of the lengths of all rectifiable paths joining $x$ to $y$.
On a graph, we can introduce a distance by declaring every edge to be isometric to the unit interval in $\mathbb{R}$. In this case, instead of taking the infimum of the lengths of the paths, the minimum is taken. Here is my trouble, since I do not understand why the infimum is the same as the minimum in this case.
Thanks in advance.
You are indeed taking the infimum, $$ d(x,y):=\inf\{|\gamma|: \gamma \text{ connects }x \text{ and } y\}. $$ but as $$ A:=\{|\gamma|: \gamma \text{ connects }x \text{ and } y\} \subset \mathbb{N}, $$ we have some additional structure due $A$ being a discrete set.
Now, as $d(x,y)$ is an accumulation point of $A$(this just comes from the definition of infimum), there is a sequence of elements $\{n_k\}_{k} \subset A \subset \mathbb{N}$ with $n_k \longrightarrow d(x,y)$. However, a sequence of natural number can only converge if it is eventually constant, that is $\exists K \in \mathbb{N} $ such that for all $k \ge K$, $n_k = d(x,y)$.
As $n_K \in A$, there is a path $\gamma^\prime$ connecting $x$ to $y$ such that $|\gamma^\prime|=n_K = d(x,y)$. That is, the infimum is in fact achieved. Therefore, you can take the minimum in the definition.