[C++] Why can't I control a pawn?

I can’t seem to be able to control my pawn. The camera doesn’t kick in, and instead of controlling the pawn, I control the default flying-player thing.
Here’s my code:

[MyCharacter.h]

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/Pawn.h"
#include "MyCharacter.generated.h"

UCLASS()
class ACTUALPROJECT_API AMyCharacter : public APawn
{
	GENERATED_BODY()

public:
	// Sets default values for this pawn's properties
	AMyCharacter();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

	// Attaching the camera
	virtual void AttachCamera(UCameraComponent*);

	// Our axis bindings
	virtual void MoveY(float);
	virtual void MoveX(float);

	UPROPERTY(EditAnywhere)
	USceneComponent* VisibleComponent;
	
};

[MyCharacter.cpp]

// Fill out your copyright notice in the Description page of Project Settings.

#include "ActualProject.h"
#include "MyCharacter.h"
#include "Runtime/Engine/Classes/Components/InputComponent.h"

// Sets default values
AMyCharacter::AMyCharacter()
{
 	// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	// Set this pawn to be controlled by the lowest-numbered player
	AutoPossessPlayer = EAutoReceiveInput::Player0;

	// Create and attach our root component
	RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));

	// Create and attach our camera
	UCameraComponent* Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("PlayerCamera"));

	// Create the visible object
	VisibleComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisibleComponent"));

	// Attach the camera
	AMyCharacter::AttachCamera(Camera);

	// Attach the visible component to the root
	VisibleComponent->AttachTo(RootComponent);
}

// Attach the camera
void AMyCharacter::AttachCamera(UCameraComponent* camera)
{
	camera->AttachTo(RootComponent);
	camera->SetRelativeLocation(FVector(-250.0f, 0.0f, 250.0f));
	camera->SetRelativeRotation(FRotator(-45.0f, 0.0f, 0.0f));
}

// Called when the game starts or when spawned
void AMyCharacter::BeginPlay()
{
	Super::BeginPlay();
}

// Called every frame
void AMyCharacter::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

// Called to bind functionality to input
void AMyCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	Super::SetupPlayerInputComponent(InputComponent);

	// Binding axis to move
	InputComponent->BindAxis("MoveY", this, &AMyCharacter::MoveY);
	InputComponent->BindAxis("MoveX", this, &AMyCharacter::MoveX);
}

void AMyCharacter::MoveY(float vel)
{
	if (vel == 0.0f)
		return;

	// The current actor location
	const FVector CurrentLocation = GetActorLocation(RootComponent);

	// Setting the actor location, with the velocity
	SetActorLocation(FVector(CurrentLocation.X, CurrentLocation.Y + vel, CurrentLocation.Z));
}

void AMyCharacter::MoveX(float vel)
{
	if (vel == 0.0f)
		return;

	// The current actor location
	const FVector CurrentLocation = GetActorLocation(RootComponent);

	// Setting the actor location, with the velocity
	SetActorLocation(FVector(CurrentLocation.X + vel, CurrentLocation.Y, CurrentLocation.Z));
}

Did you set the DefaulPawnClass in your gamemode? And are you using that custom gamemode in your level? If that’s not the case then Unreal uses the default gamemode and therefore also the default spectator pawn. You can set the gamemode either under your world settings, or Project Settings → Maps and Modes.
On a side note, there are also probably easier ways about implementing movement, such as inheriting from ACharacter and calling AddMovementInput.

Becauase in order to make pawn be controlled it needs to be possessed by PlayerController of player that suppose to control it, possession by default will also change view target to that pawn so camera will change. PriftD is one way of doing it, default spawn system automaticly posses spawned pawn, other way if you already have pawn on level you use Possess function:

So in short way UE4 control model works is you have pawn class which is controlable actor and you got controllers which control those pawns, theres PlayerController spawned for each player which transfers player input to move pawn, but there also AI controllers for UE4 AI system to control the pawn, but you can create even more custom controller if you like.