How to query custom fields on Activity?

you can only run your SOQL queries either on Tasks or Events..

Select Id,YourCustomField__c from Task
Select Id,YourCustomField__c from Event

I believe Activities/Activity is a single logical object type holding both Tasks & Events.. and Tasks and Events are the concrete physical object types that you can run your queries on..

Activities Custom fields is one common place for creating custom fields for both Tasks & Events..

you can also run queries on OpenActivities object related to a particular object (like Lead, Account..)