The error is raised, since the flattened activation output contains more number of features than the first linear layer (self.fc1) expects. This line of code:
x = x.view(x.size(0), 16*5*5)

creates a tensor in the shape [batch_size, 16*5*5=400], while (based on the error message) it contains 595360 features.
You could thus use:
x = x.view(x.size(0), -1)

to flatten the tensor and create self.fc1 as:
self.fc1 = nn.Linear(in_features=595360, out_features = 300) 

or alternatively resize the input tensor to a smaller spatial size than 256x256.