earth like planet orbiting around a sun like star (365 days)
red dwarf on an elliptical orbit around the star that passes close to the planet (1896.59 days, eccentricity 0.866)
If we work in AU and years we can use $GM_{Sun} = 4 \pi^2 (\text{AU}^3 / \text{year}^2)$ for the standard gravitational parameter of the Sun. If we also assume the red dwarf's mass is small enough that it can be ignored we can leave the Earth in it's circular 1 AU orbit and assume that the Sun doesn't move. Then we can check the relationship between period and semimajor axis as follows:
$$T = 2 \pi \sqrt{\frac{a^3}{GM}} = a^{3/2}$$
$$a = T^{2/3} \left(\frac{GM}{4 \pi^2}\right)^{1/3} = T^{2/3}$$
which gives $a=1$ AU for 1 year, and $(1896.59/365)^{2/3} \approx 3 $ AU for the red dwarf so this checks out.
However your drawing is off. The periapsis and apoapsis of the red dwarf will be $3(1-e)$ and $3(1+e)$ or 0.4 and 5.6 AU and this plus this comment makes it clear that your drawing is wrong.
If the ratio of the two periods were a rational number, say $T_2/T_1 = n_2/n_1$ where $n_1, n_2$ are integers, then their relative motion would be periodic with the synodic period
$$T_S = \frac{1}{\frac{1}{T_1} - \frac{1}{T_2}} = \frac{T_1 T_2}{T_2 - T_1} = \frac{n_1 n_2}{n_2 - n_1}$$
but the distance of closest approach would depend on phasing; the initial positions at time $t=0$.
However in your case you have $a_2/a_1 = 3$ and so $T_2/T_1 = 3 \sqrt{3}$ which is irrational and not expressed as the ratio of two integers. That means that if these two orbits are in the same plane and the two bodies do not interact gravitationally with each other, sooner or later they may collide.

Python:
import numpy as np
import matplotlib.pyplot as plt
twopi = 2 * np.pi
a1, e1 = 1.0, 0.0
a2, e2 = 3.0, 0.866
theta = np.linspace(0, twopi, 201)
r1 = a1 * (1. - e1**2) / (1. + e1 * np.cos(theta))
r2 = a2 * (1. - e2**2) / (1. + e2 * np.cos(theta))
x1, y1 = [-r1 * f(theta) for f in (np.cos, np.sin)] # minus to match plot in question
x2, y2 = [-r2 * f(theta) for f in (np.cos, np.sin)]
plt.figure()
plt.plot(x1, y1, '-b', linewidth=2)
plt.plot(x2, y2, '-k', linewidth=1)
plt.plot([0], [0], 'or')
plt.gca().set_aspect('equal')
plt.xlim(-3.2, 6.8)
plt.ylim(-4, 4)
plt.xlabel('Distance (AU)', fontsize=14)
plt.ylabel('Distance (AU)', fontsize=14)
plt.show()