Let $X,Y$ be second-countable topological spaces. Let $\mathcal B(X), \mathcal B(Y),\mathcal B(X \times Y)$ be the Borel $\sigma$ algebras of $X, Y , X \times Y$ respectively.
Question: Let $B \in \mathcal B (Y)$ and $C \in \mathcal B(X \times Y)$. Is $A := \{x \in X \mid \exists y \in B \text{ s.t. } (x, y) \in C\} \in \mathcal B(X)$?
Lemma: The Borel $\sigma$-algebra of the countable product of second-countable topological spaces coincides with the product of the Borel $\sigma$-algebras.
Remark: Let $\langle X_{i}, \Sigma_{i} \rangle_{i \in I}$ be a family of measurable spaces, $X$ a set, and $\langle f_{i}: X \rightarrow X_{i}\rangle_{i \in I}$ a family of mappings. Then the $\sigma$-algebra generated by $\langle f_{i}\rangle_{i \in I}$, denoted by $\sigma(f_{i}: i \in I)$, is the smallest $\sigma$-algebra on $X$ such that every $f_{i}$ is $\sigma (f_{i}: i \in I) / \Sigma_{i}$-measurable. Let $\pi_i : \prod_{i\in I} X_i \to X_i$ be the projection maps. Then the product $\sigma$-algebra $\otimes_{i\in I} \Sigma_i$ on $\prod_{i\in I} X_i$ is the $\sigma$-algebra generated by $\langle \pi_{i}\rangle_{i \in I}$.
My attempt: By our Lemma, $\mathcal B(X) \otimes \mathcal B(Y) = \mathcal B(X \times Y)$. Let $A' = (X \times B) \cap C$. Then $A' \in \mathcal B(X \times Y)$ and $A = \pi_1 (A')$ with $\pi_1: X \times Y \to X$ being the projection map. Because the projection of a measurable set is not necessarily measurable, it may be the case that $A \notin \mathcal B(X)$.
However, I could not come up with a counter-example. Could you please provide one?
Update: My question arises from the following problem. Let $C \in \mathcal B(X \times Y)$ such that if $(x, y), (x, y') \in C$ then $y=y'$. This means $C$ is the graph of a function $f:A \to Y$ for some $A \subset X$. I'm interested in whether $f$ is measurable, i.e., $f^{-1} (B) \in \mathcal B(X)$ for every $B \in \mathcal B(Y)$.