Get data from PHP to JavaScript to set position of each post on front page

You could output them as inline CSS custom properties instead of left/top, and then use those to set the position in either CSS or Javascript.

PHP:

<a class="project" href="https://wordpress.stackexchange.com/questions/345335/<?php the_permalink(); ?>" style="—-x-position: <?php the_field('x'); ?>; —-y-position: <?php the_field('y'); ?>;'">
    <p><?php the_field("title"); ?></p>
</a>

CSS:

.project {
    top: var(—-x-position);
    left: var(—-y-position);

    /* or CSS grid: */
    grid-row-start: var(—-x-position);
    grid-column-start: var(—-y-position);
}

They’re also accessible in JS, if you need them:

var x_position = element.style.getPropertyValue("--x- position");

This will be much more manageable for responsive design since you won’t have to override inline styles with !important, but inputting such specific x/y values is generally a bad idea and you’re probably better off not intermingling presentation quite so directly with your data.